Code samples and useful algorithms

The New Boston channel on YouTube offers a fantastic variety of programming tutorials.

The following code and algorithm samples are used throughout the IB Computer Science course. Using these code examples, or a combination of them will help you during problem-solving activities, when answering past papers, and when creating your solution for the IA.

Note: This document is a work in progress and will be updated/edited as the year progresses.

Code samples

  Download the code samples here

Useful algorithms

  Download the algorithms here


As well as programming in a real programming language throughout the course, such as Java, you will also be expected to learn how to write in pseudocode. Pseudocode is a simplified language, and an alternative way to represent a program in many different languages. If you can understand a program written in pseudocode, you should be able to then re-write that program in your choice of language, and vice versa.

The programming questions in paper 1 will be written in pseudocode. Your answers to those questions should also be written in psuedocode.

The IB supply two documents that offer further reading and examples, one of which is supplied during the exams as a guide.