Skip to content

Conversation

@Deeptangshu-008
Copy link

Summary

Added binary search implementation in C++ inside algorithms/binary_search.cpp.

What’s in this PR

  • Implemented an iterative binary search function.
  • Takes a sorted vector and a target.
  • Returns index if found, otherwise -1.

Why this change?

This repo collects small, clean C++ algorithm implementations for beginners.
Binary search is essential and was missing.

Tests

Manually tested with:

  • element present
  • element not present
  • first index
  • last index

Works correctly.

Please let me know if any changes are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant