An algorithm is expressed as a set of steps. By describing the actions at each step, we instruct the computer to do something. Usually, we can use natural language to describe the actions performed at each step.

Consider this simple description:

  • Enter one integer.
  • Enter another integer.
  • Compare both integers and return the maximum value.
  • Compare both integers and return the minimum value.

If we need to find the minimum and maximum, we can either write our own general algorithms or use the prewritten algorithms from the algorithm template library available in C++.

Get hands-on with 1200+ tech skills courses.