
Computer science is all about this process of solving problems – understanding it, clearly defining it, solving it, breaking it down into small steps, and finally critically analysing the steps. Let’s consider the simple problem of sorting your list of phone contacts and describe how a computer scientist would solve it; the same concepts apply to any other problem you can solve using computation:
What does it mean for a list to be sorted? Computer scientists typically use a restricted language to avoid ambiguity: for every element in the list, the next element is equal or bigger than the current.
How can you sort a list if you’re as dumb as a computer? You take each subsequent pair of elements in the list and if they are in the wrong order, you swap. Repeat this until no more swaps are necessary. Solving harder problems such as scheduling flights for an airline or creating an online trading robot, would involve going through increasing levels of detail until all the steps are basic ones.
Finally, the computer scientist asks several questions: Do the steps guarantee the final outcome is correct, i.e. a sorted list of contacts? (In fact they do.) Is there a more efficient way of sorting the list? (There actually is! If you are interested look up Quick Sort or Merge Sort.)