Chapter 1 : Computational Thinking
• Computational thinking is the thought processes involved in formulating a problem and expressing its
solution in such way that a computer can understand thus effectively carry out.
• In a logical argument the things we already know or assume are called the premise and therefore, a
statement, which is either true or false. Once all premises are known, we can begin analyzing them to
form a conclusion.
• Algorithms are an ordered sequence of clearly defined steps that describe a process of computation
with clear start and endpoints for solving a particular problem.
• When writing an algorithm you have to think about a few things:
- State and variable: The state of an algorithm covers the current values that the algorithm is
keeping track of. A variable stores a certain value and needs to be explicitly assigned its value.
- Iteration(looping): Allows for a series of steps to be repeated without the need of manually
writing down each step. Variables are used for this.
- Selection: Tests the value of a variable at each iteration and acts according to a predefined set of
conditions. Conditions can be used everywhere.
- Pseudocode: A high-level description of an algorithm or computer program. An algorithm in
pseudocode is suitable for a human “computer”.
• A computer program consists of instructions executing one at a time. Basic instruction types are:
input, getting data, process, performing computations on data and output, output the data.
• Programs use variables to refer to data.
• Problem solving: Creating a methodical solution to a given task.
• When trying to solve a problem, the most important thing is to be very precise when defining the
problem, this way you get a clear goal to work towards to.
• There are several problem solving strategies, among which:
- Decomposition: Breaking down a task into several smaller and manageable tasks. It’s part of the
larger realm of divide-and-conquer strategies.
- Brute force: Trying all possible solutions in the search for the best one.
- Discover structure or pattern: By recognizing a pattern or solution, you can use that knowledge
to help you figure out similar problems.
- Making a model: Sometimes models give a simplified picture and make things more clear.
- Using mental toolboxes: Studying existing solutions, seeing patterns and generalizing will help
solving future problems.
• Abstraction: Expressing an idea in a specific context while hiding details that are deemed irrelevant in
that context. It operates at a certain level of detail, determined by how much you actually need to
understand.
Chapter 2 : Searching and Big-O
• To determine whether a solution is of good quality, you can check 4 things:
- Correctness: Does the solution actually solve the original problem? Factual.
- Efficiency: Does it take the least amount of time and space to solve the problem? Factual.
- Elegance: Is it simple yet effective? Subjective.
- Usability: Does it serve a purpose and is it readable for the targeted users? Subjective.
• Each solution has its own trade-offs. A common one in software engineering is the space-time trade-
off. Meaning some solutions may use less memory, but require more time to compute and vice versa.
• Thus your solution will inevitably involve compromises. Choosing the right trade-offs and the extent
of these trade-offs is what distinguishes a mediocre developer from a great programmer.
• Linear search: Search algorithm that starts from the beginning of a list, and checks each element until
the search key is found or the end of the list is reached. An example of brute force and the only option
if the list isn’t sorted.
• Runtime: The time it takes for an algorithm to execute.
1/6