No history yet

Introduction to Computer Science

Thinking Like a Computer

You already have a head start in computer science. As a prompt engineer, you know how to break down a complex task into clear, specific instructions for an AI. You guide it, step-by-step, to get the result you want. This process of structured thinking is the heart of computer science. It’s called computational thinking.

It’s not about thinking like a machine, but rather about solving problems in a way a machine could execute. It boils down to four key practices:

This framework turns massive, messy problems into orderly, solvable ones. It’s a strategy for getting from a question to an answer, which is exactly what programming is all about.

The Power of a Recipe

The final step of computational thinking, algorithm design, is where your solution takes shape. An algorithm is just a fancy word for a step-by-step set of instructions for completing a task. If you’ve ever followed a recipe to bake a cake, you’ve used an algorithm.

A computer program is a sequence of instructions. An algorithm is the idea behind those instructions.

Algorithms must be precise and unambiguous. A recipe might say "bake until golden brown," which is subjective. A computer needs instructions like "bake at 350°F for 25 minutes." There is no room for interpretation.

Consider the task of finding the largest number in a list: [17, 3, 42, 8, 25]. A simple algorithm would be:

  1. Pick the first number (17) and call it the 'largest so far'.
  2. Go to the next number (3). Is it larger than 17? No.
  3. Go to the next number (42). Is it larger than 17? Yes. Make 42 the new 'largest so far'.
  4. Go to the next number (8). Is it larger than 42? No.
  5. Go to the next number (25). Is it larger than 42? No.
  6. You've reached the end of the list. The 'largest so far' (42) is your answer.

This simple, repeatable process is exactly how a computer would solve the problem.

Talking to Machines

An algorithm is an idea. To make it useful, we need to communicate it to a computer. We do this using programming languages. A programming language is a formal language with specific rules that a computer can understand and execute. It’s the bridge between human ideas and machine action.

There are hundreds of programming languages, like Python, Java, C++, and JavaScript. Some are more abstract and human-readable (high-level languages), while others are closer to the machine's native instructions (low-level languages). For now, the specific language doesn't matter. The important thing is the underlying logic—the algorithm—which is transferable between languages.

To avoid getting bogged down in the syntax of a specific language, programmers often sketch out their algorithms in pseudocode. It's an informal, high-level description of an algorithm's operating principle, using the structural conventions of a normal programming language, but intended for human reading rather than machine reading. Here's our 'find the largest number' algorithm in pseudocode:

FUNCTION find_largest(list_of_numbers)

  SET largest_so_far = first number in the list

  FOR EACH number in list_of_numbers:
    IF number > largest_so_far THEN
      SET largest_so_far = number
    END IF
  END FOR

  RETURN largest_so_far

END FUNCTION

Notice how it's clear and readable, without any confusing symbols or strict formatting. It focuses purely on the logic. This is the core of problem-solving in computer science: first, figure out the logical steps, and only then worry about translating them into a specific language.

Ready to test your understanding? Let's try a few questions.

Quiz Questions 1/5

What is the primary goal of computational thinking?

Quiz Questions 2/5

A recipe instructs you to 'bake until golden brown'. Why is this instruction NOT a good example of a step in a computer algorithm?

By mastering these foundational ideas, you're learning to structure your thoughts in a powerful new way. This systematic approach to problem-solving is the most valuable skill in computer science, and it applies far beyond just writing code.