Algorithms

From Dev Wiki
Jump to navigation Jump to search

For the most part, the theory and study of Algorithms deals with runtime and size complexity. That is "how fast does this code run, and/or how much space does it take up while running?"

More often than not, we only care about the the computational time (speed) of the algorithm. However, depending on data size and hardware limitations, memory, communication, or other space-related resources are the focus as well. To be more precise, we can define a few key terms:

  • Algorithm - Any well defined, step-by-step procedure for performing some task in a finite amount of time.
    • Generally takes some value as input and produces some value as output.
  • Algorithm Correctness:
    • An algorithm is "correct" if, for every input instance, the algorithm halts/ends with the correct output.
    • An algorithm is "incorrect" if for some input instances:
      • The algorithm does not halt.
      • The algorithm halts/ends, but provides incorrect output.
  • Data Structure - A way to store and organize data in order to facilitate access and modification.
  • Running time - The number of "Primitive Operations" a piece of code needs to execute to finish running.

Algorithms Topics