0

Whats the syntax of binary search?

15th Aug 2017, 3:55 PM
Kaustav Gupta
7 ответов
+ 1
Binary search takes a sorted list and finds where a number/word is located in that list. Its called binary search because each time a search is done the nunber of items remaining to search is cut in 1/2. I will represent where is being searched with a | symbol. Take the following list: search for the number 20: 1 2 3 7 8 11 | 15 20 21 22 30 35 <---- 20 bigger 15 20 21| 22 30 35 <---- 20 smaller 15 | 20 21 <---- 20 found In general this search operates on O(Log2 N) where N is the length of the list
15th Aug 2017, 5:38 PM
S C
+ 1
its long so i cant write it here. but if u know the concept then u can do it.
15th Aug 2017, 4:08 PM
shobhit
shobhit - avatar
+ 1
should i tell concept.
15th Aug 2017, 4:09 PM
shobhit
shobhit - avatar
+ 1
man just see them there are many of them in sololearn code section
15th Aug 2017, 4:17 PM
shobhit
shobhit - avatar
0
tell me
15th Aug 2017, 4:09 PM
Kaustav Gupta
0
just tell me the program body
15th Aug 2017, 4:11 PM
Kaustav Gupta
0
Please google these sort of questions.
15th Aug 2017, 4:31 PM
Salekin
Salekin - avatar