Skip to content
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

iterative_binarysearch #751

Open
shivamdroidoreo opened this issue Oct 2, 2024 · 3 comments
Open

iterative_binarysearch #751

shivamdroidoreo opened this issue Oct 2, 2024 · 3 comments

Comments

@shivamdroidoreo
Copy link

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
Copy link

Arhaan-P commented Oct 5, 2024

Please assign this to me

@TusharNaugain
Copy link

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
Copy link

pls give this issue to me

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

No branches or pull requests

4 participants