Skip to content

binary search questions#2451

Open
jose-rafael-marcano wants to merge 1 commit intosuper30admin:masterfrom
jose-rafael-marcano:master
Open

binary search questions#2451
jose-rafael-marcano wants to merge 1 commit intosuper30admin:masterfrom
jose-rafael-marcano:master

Conversation

@jose-rafael-marcano
Copy link
Copy Markdown

Binary Search

Problem1
Search a 2D Matrix(https://leetcode.com/problems/search-a-2d-matrix/)

Problem2
Search in a Rotated Sorted Array (https://leetcode.com/problems/search-in-rotated-sorted-array/)

Problem3
Search in Infinite sorted array:

https://leetcode.com/problems/search-in-a-sorted-array-of-unknown-size/**

@super30admin
Copy link
Copy Markdown
Owner

Strengths:

  1. Correct implementation of binary search for a rotated sorted array.
  2. Proper handling of edge cases (null or empty array).
  3. Good use of comments to explain the logic.
  4. Appropriate variable naming and code structure.

Areas for Improvement:

  1. The condition nums.length<0 in the initial check is redundant since array length cannot be negative. It should be nums.length==0.
  2. The main method is empty and could be used to include test cases for better verification of the solution.
  3. The comments could be more detailed to explain the logic of identifying the sorted side and performing the search.

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