Skip to content

Completed binary search1 #2338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ramya-gopalaswamy
Copy link

No description provided.

@super30admin
Copy link
Owner

Strengths:

  • Good understanding of binary search concepts
  • Proper use of comments to explain the approach
  • Correct implementation of the rotated sorted array search (Problem2.cpp)
  • Appropriate handling of edge cases (empty matrix in Problem1.cpp)

Areas for Improvement:

  • Problem3.cpp has a duplicate while loop (lines 22-25 are identical to 18-21)
  • The binary search logic in Problem3.cpp has issues (checking midVal > target || midVal == INT_MAX together could lead to incorrect behavior)
  • The time complexity claim for Problem3.cpp might not be accurate due to implementation issues
  • Consider adding more test cases to verify edge cases in Problem3.cpp

For Problem3.cpp specifically:

  1. Remove the duplicate while loop
  2. Fix the binary search condition to properly handle the case when midVal is INT_MAX
  3. Consider adding bounds checking to prevent infinite loops

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.

2 participants