on what program execution time depends upon

This is a discussion on on what program execution time depends upon within the C Programming forums, part of the General Programming Boards category; I got a question when I started reading about searching and sorting.. my question is : 1. On what factors ...

  1. #1
    Registered User
    Join Date
    Jan 2011
    Posts
    113

    on what program execution time depends upon

    I got a question when I started reading about searching and sorting..
    my question is :
    1. On what factors does program execution time depends upon ?
    - its on the number of lines we have written / logic we have used / both / any other..

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Mostly it will depend on 2 things...
    1) The speed of the computer
    2) The efficiency of the code.

    #2 can be related to lines written, etc... but mostly it will be related to how you minimize the amount of work done to accomplish the task. For example... a linear search is very "code efficient" but on large arrays or files the further it has to look the slower it gets, finding the 1000th element takes 1000 tries... On the other hand a binary search needs more code but --provided the data is sorted-- it's going to be blazing fast finding any one of a thousand elements in only 10 tries. There are also many situations were the reverse is true... smaller code gives better results...

    It's all up to our skill as programmers, part of the task is finding the most efficient way to do the job.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,420
    Algorithms are usually described by their "big-O" value.
    Big O notation - Wikipedia, the free encyclopedia

    But this only describes what happens on an abstract machine for very large values of 'n'.

    For more realistic values of 'n', or where 'n' is really small, then all the factors such as choice of processor, choice of language and programmer skill (in choosing the right algorithm, and skill at implementing the algorithm) all come into play.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to get program execution time
    By pobri19 in forum C++ Programming
    Replies: 8
    Last Post: 01-20-2009, 06:45 AM
  2. Comparing time taken for execution
    By AvaGodess in forum C Programming
    Replies: 15
    Last Post: 10-02-2008, 02:15 PM
  3. execution time
    By shuo in forum C++ Programming
    Replies: 3
    Last Post: 10-17-2007, 02:58 AM
  4. Execution Time in Microseconds?
    By thetinman in forum C++ Programming
    Replies: 11
    Last Post: 06-02-2007, 01:32 PM
  5. Windows 2k Dos- Program Execution Time
    By maththeorylvr in forum C Programming
    Replies: 1
    Last Post: 03-17-2005, 09:03 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21