-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Competitive Programming: Binary Search Documentation #2509
Competitive Programming: Binary Search Documentation #2509
Conversation
This Contains information about what is a programming language and brief information about different types of programming language
…buting into Frontend_Web_Development_React_Angular_Vue
[structure] : Redefine, Rename files, Sections Added
…github.com/girlscript/winter-of-contributing into Frontend_Web_Development_React_Angular_Vue
Signed-off-by: Asmit2952 <[email protected]>
Python: 1.4 What is a programming language? girlscript#77
…oject_Mentorship_Program 4.14 Open Mainframe Project Mentorship Program
OpenSource : 4.10 Explain everything related to Free Software Foundation (FSF)
…github.com/girlscript/winter-of-contributing into Frontend_Web_Development_React_Angular_Vue
Create What_is_an_object_in_Python.md
Frontend With FrameWorks -All About npm girlscript#352
* Delete issue-assign.yml * Delete Issue_watcher.yaml * Update greetings.yml
…opment_React_Angular_Vue merge: Frontend web development react angular vue
merge: Machine learning
merge: Python
merge: UI_UX
update bot to limit to 3 max issues being assigned to a single user
* Delete issue-assign.yml * Delete Issue_watcher.yaml * Update greetings.yml * Create issue-assign.yml * Update greetings.yml * Update greetings.yml * Update greetings.yml * Update greetings.yml * Fixed Java & Python mismatch * Update ISSUE_TEMPLATE.md * Update PULL_REQUEST_TEMPLATE.md * Update issue-assign.yml * Update ISSUE_TEMPLATE.md * Update keylabeler.yml * Update PULL_REQUEST_TEMPLATE.md * Delete ISSUE_TEMPLATE.md * Create issue-form.yml * Update PULL_REQUEST_TEMPLATE.md * Update keylabeler.yml * Update PULL_REQUEST_TEMPLATE.md * Hashtag check * Update PULL_REQUEST_TEMPLATE.md * Update issue-form.yml * Update keylabeler.yml * Update PULL_REQUEST_TEMPLATE.md * Update keylabeler.yml
|
||
#### Code in C++: | ||
|
||
```c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add pseudo-code of binary search.
|
||
--- | ||
<p align="center"> | ||
<img width="460" height="300" src="https://miro.medium.com/max/247/1*fMQ2cLdIEr3DoHitYyiSsg.png"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please use a clearer image? And please give image credit if you are using an image from a different source.
} | ||
``` | ||
|
||
## Binary Search Problems |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Binary Search Problems | |
## Some common binary search problems |
|
||
## Binary Search Problems | ||
### Question: | ||
### Find the index of first 1 in a sorted array of 0’s and 1’s if 1 is not present in the array print -1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### Find the index of first 1 in a sorted array of 0’s and 1’s if 1 is not present in the array print -1 | |
### Find the index of first 1 in a sorted array of 0’s and 1’s if 1 is not present in the array then print -1 |
## End Note | ||
Hope this documentation provided you some basic idea about binary search algorithm and how to solve questions using this approach. | ||
Binary search runs in logarithmic time in the worst case, making O(log n) comparisons, where n is the number of elements in the array.Binary search is faster than linear search except for small arrays. However, the array must be sorted first to be able to apply binary search. There are specialized data structures designed for fast searching, such as hash tables, that can be searched more efficiently than binary search. However, binary search can be used to solve a wider range of problems, such as finding the next-smallest or next-largest element in the array relative to the target even if it is absent from the array. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these extra blank lines.
Ok I will do the changes ASAP |
@atarax665 I have made the required modifications. If it still needs further changes then kindly inform me 😃 |
Please do not merge the main branch with mybranch as you are making a contribution to the Competitive_Programming branch which is not synced with the main branch. |
@atarax665 Can you assist me in making this issue resolved? |
Description 📜
Format: Documentation
Made the documentation on the binary search algorithm.
AIM
Added code to explain the algorithm and made documentation in the .md format
Acknowledgment
To my mentor @atarax665 helping me making commit and PR for this issue, a big shoutout to him 🥳
do let me know if there are still any more changes that need to be done👍
👍
Fixes #949
Type of change 📝
Domain of Contribution 📊
Checklist ✅
Screenshots / Gif (Optional) 📸