Algorithms Chapter II practice report

practice report

A practice topic

 

 

Second, the description of the problem

  A descending array consisting of non-integer n, a binary lookup algorithm to find a fixed number, and outputs the number of subscripts and run algorithms compare this number in the array.

 

Third, the algorithm description

 

 

 

 Fourth, the complexity of time and space analysis algorithm

1, time complexity

  Each comparison are all Comparing median array, so the time complexity is O (log2 n)

2, space complexity

  Space complexity is O (1)

 

Fifth, feelings and experiences

  Write a recursive algorithm process of over-reliance, to learn the process of how to do recursive algorithm to achieve a similar recursive, reduce the time complexity.

Guess you like

Origin www.cnblogs.com/cmh2969/p/11568985.html