sbmxc / hacktoberfest

Create your first PR! Don't forget to star if it helped!
109 stars 556 forks source link

iterative_binarysearch #751

Open shivamdroidoreo opened 3 weeks ago

shivamdroidoreo commented 3 weeks ago

Improvements: Use of <bits/stdc++.h>: This header includes all standard library headers, which can increase compilation time unnecessarily. It is better to include only the specific headers you need, in this case, .

Pass large arrays by reference: While this is not strictly necessary in this small example, for large arrays, it is generally more efficient to pass them by reference rather than by value.

Variable naming: Use more descriptive variable names, such as left, right, and mid, instead of abbreviations like l, r, and m. This enhances code readability.

Edge case handling: The code does not have any significant flaws in logic, but ensuring that it's applied only on sorted arrays is important in practice. Perhaps adding a comment about it or including an assertion that checks if the array is sorted might help in larger projects.

Arhaan-P commented 3 weeks ago

Please assign this to me

TusharNaugain commented 2 weeks ago

To solve this issue in a simpler and easier manner, we can refactor the code to include the necessary headers, pass arrays by reference, and use descriptive variable names. Kindly assign this issue to me!

siabatra commented 2 weeks ago

pls give this issue to me