October 22, 2026

What I did to learn computer science

Why is learning Computer Science important?

A Computer Science base is very important as it:

  • Enables more effective communication with Artificial Intelligence systems.
  • Enables more efficient and precise input formulation.
  • Accelerates problem-solving and algorithmic thinking when designing automated workflows.

Increasing productivity

With a Computer Science base, very efficient and precise inputs can be formulated.

For instance, learning what a loop is enables more efficient input creation. As you can reference a set, and have repetitive transformations happen to each element in the set by using a for loop.

For instance, imagine a website, with a page that has 10,000 images on it and you want to update 100 images that belong to the same group, and the update involves adding the same border style around each image. To do so, a contextualised word set based on this template can be used:

For each [element] in [encapsulating set] do this: [action set]

And the contextualised word set is something like:

For each [image] in [the 100 image group on the page] do this: [add a 3px red border around each image]

And that, is much more efficient, than manually referencing 100 images.

One for-each instruction bordering all 100 images in a groupThe 100 images of one group, on a page of 10,000 images, and one for-each instruction: for each image in the group, add a 3px red border. The instruction reaches each image in turn, row by row, until it has bordered all 100, so one instruction does what would otherwise take 100 separate references, one per image.

Studying computer science

I started learning Computer Science with intensity in January 2022.

I didn't study computer science at university.

I learnt it all online via Google Search, YouTube, X.com, and AI.

When I started I was already comfortable creating Excel functions like INDEX/MATCH, VLOOKUPS, COUNTIFS, etc.

I gradually learnt various concepts and did exercises. I'd read, watch video tutorials, and do coding exercises on Codewars and LeetCode. Started with easy ones and then scaled.

As I was learning, I used things like concept compression, active recall, and spaced repetition.

I tried using ANKI but found it just didn't click. I found the interface a little bit clunky. I just extracted insights into Notion. With every topic getting a single page or so. And did recall almost every day.

I concentrated on getting good at describing what needs to get done, keeping things simple, and getting good at debugging.

If you learn the things in the next section, you are going to have a decent base that is going to be very helpful when engaging with Artificial Intelligence systems.

Useful things to learn

Classes

  • Classes: A blueprint/template for an object
  • Objects: An instance from a class. Objects can store data and do actions
  • Construction: Creating an object from a class blueprint and initialising its starting data
One class constructing three objectsA class, drawn as a dashed blueprint card, declares three empty fields. Constructing three objects from it, one at a time, gives each the same three fields as the blueprint, filled with values of its own, and leaves the blueprint itself unchanged.

Data

  • Data types: Categories for primitive data pieces such as booleans [true or false], integers [whole numbers], floats [numbers with decimal points], and strings [character based text sequences]
Ten pieces of data, each sorted into one of four data typesFour data types, drawn as bins headed Boolean, Integer, Float and String, and ten pieces of data sorted into them one at a time, each into the type its value belongs to. Booleans are either true or false. Integers are whole numbers: 42, 0 and −7. Floats have a decimal point: 3.14, 0.5 and −2.75. Strings are sequences of characters in quotes: "cat" is the characters c, a and t, and "hi" is the characters h and i. No piece belongs to more than one type.
  • Data structures: Structures for storing and organising data, the 3 main types being linear data structures [arrays, lists, stacks, queues], graphs [linked lists, trees, DAGS, etc], and hash maps [key value pairs like a dictionary]
Three data structures, each storing one new item its own wayThree structures for storing and organising data, each storing one new item. A linear structure keeps its items in a row, in order, each at a numbered position: the array 7, 2, 9 and 4 stores 6 at the end, at position 4. A graph keeps its items as nodes joined by edges: the tree of A, B, C and D stores E, joined to C. A hash map files each value under a key, like a word and its definition in a dictionary: Ann maps to 31 and Ben maps to 27, and Cal is stored with 45.
  • Variable: A sticky note with a name written on it and then linked to a box
A variable: a sticky note named score, linked to a box holding 42A variable pictured as a sticky note with a name written on it, linked to a box. The code score = 42 writes the name score on the note and links it to a box holding 42: the name is how the value is found, by following the note to the box it is linked to. The note does not hold the value; the box does.

Control Flow

  • Conditions: Statements that are true or false
Four conditions, each checked and found true or falseFour conditions, each a statement that is either true or false, with nothing in between. 5 > 3 is true. 2 + 2 == 5 is false. "cat" == "cat" is true. 10 < 7 is false. Each statement is checked in turn, and each comes out as exactly one of the two values.
  • If Statements: Condition based action sequences
An if statement choosing which of two action sequences runsAn if statement drawn as a flowchart. Its condition asks: is it raining? When the condition is true, one action sequence runs: take an umbrella, then go outside. When it is false, the other runs instead: wear sunglasses, then go outside. The condition's value decides which sequence runs, and both paths join again at the last action, go outside.
  • For Loops: Repeat code for every element within a structure
A for loop visiting every element onceA structure of six elements and a for loop over it. The loop visits the elements one at a time, left to right, marking each as its code runs for that element, until it has marked all six, once each. Then the loop ends.
  • While Loops: Repeat code while a condition is true
A while loop keeping a heater on while the room is 22°C or underA while loop that runs a heater. Its condition is that the room is 22°C or under, and its code keeps the heater on, warming the room by one degree each repeat. Before every repeat the loop checks the condition, and while it is true the heater stays on: five repeats, from 18°C up to 23°C. At 23°C the condition is false, so the heater switches off and the loop stops: the temperature, not a count fixed in advance, ended it.

Algorithms

  • Algorithms: Step-by-step recipes to create something
An algorithm as a recipe: four steps to create a houseAn algorithm drawn as a recipe: four numbered steps to create a house. Step 1, lay the base. Step 2, build the walls. Step 3, add the roof. Step 4, fit the door. The steps run one at a time, in order, and each adds its part to the house. The order matters: the walls need the base, the roof needs the walls and the door needs the walls. When step 4 has run, the house is complete.
  • Functions: A reusable code machine that houses step-by-step recipes to create something
A function reused on three inputsA function drawn as a machine that houses a recipe of three numbered steps. The machine takes three different inputs, one call at a time. On each call the recipe runs its steps in order, 1, 2, then 3, and creates an output: a square as wide as the input circle it came from. The same machine handles every input, so the recipe is written once and reused.
  • Time complexity: Measures how an algorithm's execution time scales as the input size increases

  • Space complexity: Measures how an algorithm's memory space usage scales as the input size increases

The worst and best case of binary search as its input growsA chart of the time binary search takes to find a target in ordered values, counted in steps of one comparison each, as the input grows from one value to 63. The worst case, Big O, climbs by one comparison each time the input doubles, reaching six comparisons at 63 values. The best case, Big Omega, stays at one comparison: the target is the first middle value compared. The dots are real runs, every number of comparisons some target needs at that size, and every run lands between the two.
  • Big O Notation [Worst case] and Big Omega Notation [Best case]
Seven growth classes compared as the input growsA chart of the steps an algorithm takes as its input grows, one curve for each of seven growth classes, the cheapest lowest. Constant, O(1), stays flat. Logarithmic, O(log n), rises ever more slowly. Linear, O(n), climbs in a straight line. Linearithmic, O(n log n), bends upward, faster than linear. Quadratic, O(n squared), exponential, O(2 to the n), and factorial, O(n factorial), climb out of the top of the chart, factorial first and quadratic last. Big O names the class an algorithm's worst case grows within, and Big Omega the class its best case grows within: the same classes, read as a ceiling or a floor.

Recursion

  • Recursion: Where a function calls itself
  • Base case: Condition that stops infinite recursion
  • Recursive case: Call to itself with a varying input
  • Call stack: Each recursive call adds a new layer to the stack until the base case is reached, which then resolves them in reverse order (LIFO)
A recursion descending to its base case, then returningA function calls itself three times, each with a different input: f(4) calls f(3), which calls f(2), which calls f(1). The calls stack up, each below the one that made it, until f(1), the base case, stops the recursion by making no further call. The calls then return in reverse order, the last call made returning first.

Search

  • Binary Search: An efficient algorithm for searching ordered sequences for a specific value by running a loop, that: Computes the search range, computes the middle element, compares the middle element to the target, checks if the middle element matches the target, and if there is a match the search is done, and if there isn't a match, the algorithm recomputes the search range by splitting it in half and repeats the process on the remaining half
Binary search finding 42, one step at a timeA row of 15 values in ascending order, 3, 6, 10, 14, 17, 21, 26, 30, 33, 38, 42, 47, 51, 55, 60, at indexes 0 to 14, and a target, 42. Each round computes the range, then its middle index, then compares the middle value to the target. Round 1: the range is index 0 to 14; the middle index is 0 plus 14, halved, which is 7; its value, 30, is less than the target, so the search continues from index 8 to 14. Round 2: the range is index 8 to 14; the middle index is 8 plus 14, halved, which is 11; its value, 47, is greater than the target, so the search continues from index 8 to 10. Round 3: the range is index 8 to 10; the middle index is 8 plus 10, halved, which is 9; its value, 38, is less than the target, so the search continues from index 10 to 10. Round 4: the range is index 10 to 10; the middle index is 10 plus 10, halved, which is 10; its value, 42, equals the target, so it is found at index 10. It takes four comparisons.
  • Depth-First Search: A graph based search algorithm that involves traversing a graph pathway by pathway, and when a pathway is fully explored, there is reversal in direction to explore the nearest unexplored pathway [a pathway is just a node set sequence]
Depth-first search exploring a tree pathway by pathwayA tree of ten nodes, searched depth first from the top. The search follows one pathway down to its end, then reverses direction to the nearest node that still has an unexplored branch, and follows that pathway down in turn: one step back after the first pathway, two after the second, two after the third, and one after the fourth. It numbers each node as it reaches it, 1 to 10, so the numbers run down each pathway before moving to the next.
  • Breadth-First Search: Graph based search that explores the nearest encapsulating node set before expanding
Breadth-first search spreading outward one ring at a timeA start node sits at the centre of three rings, like the growth rings of a cut tree trunk. Every node on a ring is one step from a node on the ring inside it, so the rings count the steps: every node on the third ring is three steps from the start. Breadth-first search visits the start, then every node on the first ring, then the second, then the third: the nearest set first, one ring at a time.

Dynamic Programming

  • State & Transition: Identify overlapping subproblems and optimal substructure via recurrence relations
  • Top-down: Recursion & memoisation [storing computed results]

For example, Fibonacci uses F(n) = F(n − 1) + F(n − 2), with F(0) = 0 and F(1) = 1. Start with the number you want, break it into smaller calls, and save each result. Dashed boxes reuse a saved result instead of expanding the same branch again.

Fibonacci solved top down with memoisationA top-down Fibonacci call tree computing F(5) = 5. Calls check for a saved result before recursing. Otherwise, a base case returns its input, or a recursive call adds its smaller results and saves the sum. Dashed boxes mark F(1), F(2), F(3), which reuse saved results without expanding again. The tree solves only six distinct inputs.
  • Bottom-up: Tabulation based matrix chain multiplication

Start with the smallest subproblems and build up. Here, A1 to A4 are matrices. Each box names a chain segment and stores its minimum multiplication cost. A single matrix costs 0; longer segments reuse previously stored costs. The links show the two parts created by the current best split.

A matrix chain table filled bottom upA table for multiplying a chain of four matrices, sized 2 by 3, 3 by 4, 4 by 2 and 2 by 5, in the cheapest order, filled bottom up. Each cell holds the fewest multiplications a stretch of the chain needs, and sits over the matrices it covers. The bottom row holds the four single matrices, each costing 0. Every cell above is worked out once, from the two stored cells of its best split, plus the cost of joining them. Matrices 1 to 2, split after matrix 1: 0 plus 0 plus 2 times 3 times 4, which is 24. Matrices 2 to 3, split after matrix 2: 0 plus 0 plus 3 times 4 times 2, which is 24. Matrices 3 to 4, split after matrix 3: 0 plus 0 plus 4 times 2 times 5, which is 40. Matrices 1 to 3, split after matrix 1: 0 plus 24 plus 2 times 3 times 2, which is 36. Matrices 2 to 4, split after matrix 3: 24 plus 0 plus 3 times 2 times 5, which is 54. Matrices 1 to 4, split after matrix 3: 36 plus 0 plus 2 times 2 times 5, which is 56. The top cell, the whole chain, costs 56 multiplications.

Execution

  • Async: Temporal execution varies
  • Debugging: Fixing problems
  • Verification: Verifying that everything works

Context

Prior to learning Computer Science online, I did have a decent quantitative base. And a decent qualitative base.

Math is something I've been decent at since I was a kid. I got a gold medal for an International Competitions and Assessments for Schools [ICAS] mathematics test when I was in grade 6. I was competing in the Southeast Asia region, which involved being in the same grading pool as kids from Singapore, etc.

When I was at university, I did a law/finance double degree. For the finance degree, I started as a quantitative finance major, and I'm pretty sure I did all the math needed, yet the records say I have a corporate finance major.