View Single Post
  #2 (permalink)  
Old 09-07-2008, 10:42 PM
morefood2001's Avatar   
morefood2001 morefood2001 is offline
Guru
 
Join Date: Jan 2008
Location: Western New York
Posts: 1,454
Last Blog:
VPS Hosting with Revie...
Credits: 0
Rep Power: 16
morefood2001 is just really nicemorefood2001 is just really nicemorefood2001 is just really nicemorefood2001 is just really nice
Send a message via AIM to morefood2001 Send a message via MSN to morefood2001 Send a message via Yahoo to morefood2001 Send a message via Skype™ to morefood2001
Default Re: Homework help - Algorithm complexity

This algorithm is an N^3 algorithm.

To get logarithm time, you need recursion so that you only hit a fraction of the total number of values. Tree data structures are good at getting logarithmic time.

For example, if you have 5 elements, you will only touch through 4 of them.
__________________
Phil Matuskiewicz
My Personal Website My Other Website
Reply With Quote