section_path: Algorithmic analysis
section_name: Algorithmic analysis
paragraph_text: Algorithmic analysis
  
  It is frequently important to know how much of a particular resource (such as time or storage) is theoretically required for a given algorithm. Methods have been developed for the analysis of algorithms to obtain such quantitative answers (estimates); for example, an algorithm that adds up the elements of a list of n numbers would have a time requirement of O (n) {\displaystyle O(n)}, using big O notation. At all times the algorithm only needs to remember two values: the sum of all the elements so far, and its current position in the input list. Therefore, it is said to have a space requirement of O (1) {\displaystyle O(1)}, if the space required to store the input numbers is not counted, or O (n) {\displaystyle O(n)} if it is counted.
  
  Different algorithms may complete the same task with a different set of instructions in less or more time, space, or ' effort ' than others. For example, a binary search algorithm (with cost O (log n) {\displaystyle O(\log n)}) outperforms a sequential search (cost O (n) {\displaystyle O(n)}) when used for table lookups on sorted lists or arrays.