0
Whats the syntax of binary search?
7 Respuestas
+ 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
+ 1
its long so i cant write it here. but if u know the concept then u can do it.
+ 1
should i tell concept.
+ 1
man just see them there are many of them in sololearn code section
0
tell me
0
just tell me the program body
0
Please google these sort of questions.