![]() |
|
#1
|
|||
|
|||
Time complexity of random loopsHi all,
I have a doubt about the asymptotic complexity of random loops. For instance, consider the loop: while(x < rand()){ do something; } Is the complexity of this loop O(x), O(1) or even another? Thanks in advance for your help. |
|||
|
#2
|
||||
|
||||
Re: Time complexity of random loopsWith algorithms that involve randomness, you need to talk about the expected running time. Quicksort is a good example. The worst case run time is quadratic if you're extremely unlucky with the random numbers that you pick, but the expected running time is O(nlog(n)).
__________________
www.blake-foster.com |
|
#3
|
|||
|
|||
Re: Time complexity of random loopsQuote:
Interesting, my guess is that its complexity is inf, because in the worst case this can be an infinite loop. But I feel that I might be wrong. I would love to see other's comments. Last edited by n00pster : 10-Nov-2008 at 03:15.
|
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| BryanSoft.Com Free Cpanel Hosting And Resellers One Time Posting!!! | rewer | Free Web Hosting | 0 | 22-Oct-2008 20:56 |
| Asynchronous transfer question | crystalattice | Miscellaneous Programming Forum | 2 | 24-Jan-2007 21:39 |
| constructors/classes | mapes479 | C++ Forum | 3 | 19-Nov-2006 18:34 |
| [CONTEST?]Data Structure Test | dsmith | C Programming Language | 2 | 06-Jun-2004 16:13 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The