![]() |
|
#1
|
|||
|
|||
Binary search algorithmHey guys I need a big help.
I have an algorithm about binary search and I need this algorithm's program. couldnt do it If anyone can do it for me I will be so happy. here is the algorithm: __________________________________________________ ____________ 1.0 Let the bottom be the initial array elements. 2.0 Let the top be the last array elements. 3.0 Let found false. 4.0 Repeat as long as bottom is not greater than top and target has not been found. 4.1 Let the middle be subscript of the element half way between bottom and top. 4.2 If the element middle is target 4.2.1 Set found to true and index ot middle. 4.3 Let top be the middle-1 __________________________________________________ _________ |
|||
|
#2
|
|||
|
|||
Re: Help me plss :(If you have reproduced it correctly, somebody has given you a flaky algorithm. That's not how you do a binary chop.
|
|
#3
|
|||
|
|||
Re: Help me plss :(Quote:
Indeed. Problem statement for an array of integers: Code:
Binary search algorithm to be implemented in C: Code:
Regards, Dave |
|
#4
|
|||
|
|||
Re: Help me plss :(Quote:
The only information i have is that. Thats why I couldnt do anything. Thanks a lot Dave |
Recent GIDBlog
Once again, no time for hobbies by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The