Register to reply 
Prove an Algorithm 
Share this thread: 
#1
Apr1305, 05:10 PM

P: 24

I have to come up with an algorithm to search a sorted array. Here it is:
Thanks 


#2
Apr1305, 05:35 PM

Sci Advisor
HW Helper
P: 2,586

Maybe you can use strong induction. Show that it works when len(inputArray) = 1, then show that if it works for all arrays of length k or less, then it works for an array of length k+1. Note that if you go through the while loop once, you come back to the top essentially dealing with an array of 1/2 the length, so it would fit in the category of "arrays of length k or less".



Register to reply 
Related Discussions  
DFS algorithm  Programming & Computer Science  2  
RSA Algorithm  Computing & Technology  2  
Prove the algorithm for LCM  Set Theory, Logic, Probability, Statistics  7  
Ln(x) algorithm  General Math  2 