Chrysolites Tech Academy

Video by freeCodeCamp.org · taught by David J. Malan · streamed from YouTube. All rights remain with the creator.

Lesson 3: Arrays, Strings and Sorting Algorithms

About this lesson

This lecture shows how programs store and work with many values at once, and introduces one of the central problems of computer science: putting things in order. It begins by looking more closely at what happens when a program is compiled, breaking the single command into its stages of preprocessing, compiling, assembling and linking. It then covers practical ways of finding bugs, from reading error messages and printing values to stepping through a program with a debugger. The main subject is the array, a way of storing many values of the same type side by side in memory. The lecture reveals that strings in C are simply arrays of characters ending with a special null character, and shows how to examine and change text one character at a time, for example converting letters to capitals using their ASCII values. You see how programs receive command-line arguments and return exit codes, and how the same character arithmetic underlies simple ciphers for scrambling messages. The second half turns to algorithms. A demonstration with volunteers searching for a number behind a row of doors compares linear and binary search, and another with volunteers on stage acts out bubble sort, selection sort and merge sort. The lecture introduces the notation used to describe how running time grows, including upper and lower bounds, and ends with a visual comparison of the sorting methods racing each other. Afterwards, read Chapter 3 of the course book, which steps through each sorting algorithm on a short list and compares how they grow.

Install Chrysolites Tech Academy

Android / Chrome / Edge: open the browser menu and choose Install app or Add to Home screen.

iPhone / iPad (Safari): tap the Share button, then Add to Home Screen.