-5

Please suggest me some examples of C programs that have long execution time, apart from the usual sorting and recursion. I want to analyze the execution times of code and would like to use some programs that have considerable execution time, not just in milliseconds.

user1727270
  • 303
  • 1
  • 3
  • 10
  • I guess you can pick up any NP problem and have programs that run for very very very long times. :) – Neo Nov 02 '12 at 21:16
  • 8
    My OS has a "long execution time". –  Nov 02 '12 at 21:16
  • Actually sorting isn't long... – alestanis Nov 02 '12 at 21:16
  • Compression software comes to mind. bzip2 is such a program and comes with full source code. – Nikos C. Nov 02 '12 at 21:16
  • 1
    @pst well, for me nlogn isn't "long" :) what about "compute the permutations of an array"? that's a nice exponential one :P – alestanis Nov 02 '12 at 21:17
  • @alestanis actually super-exponential. Exponential would mean `2^theta(x)` which it isn't. – John Dvorak Nov 02 '12 at 21:20
  • There are lots of them, especially if they are deliberately written as infinite loops. A few examples: One, the linux kernel, our servers haven't been rebooted for almost 3 years now. Another example is the Apache web server (any server actually) our web servers are restarted roughly once a month. – slebetman Nov 02 '12 at 21:20
  • @alestanis more exactly, "enumerate the permutations of x elements" is `2^theta(x log x)` – John Dvorak Nov 02 '12 at 21:22
  • Graphics rendering of complex scenes takes a lot of time. I think POVray is implemented in C – John Dvorak Nov 02 '12 at 21:24

2 Answers2

2

Implement a NP class algorithm,for example factoring numbers. Anyway,a lot of ideas are listed here: http://en.wikipedia.org/wiki/List_of_NP-complete_problems

0x6B6F77616C74
  • 2,559
  • 7
  • 38
  • 65
1

Implement any of the problems from http://projecteuler.net/. Quite a lot of them, especially with a naive implementation, can be computationally intensive.

Will
  • 4,585
  • 1
  • 26
  • 48