Quick short C programs doing common tasks, that you should memorize. We'll see how many actually show up here. But here's a list of things that you should have in your toolbox ... * One for loop * - print numbers 1 to n, or multiples of k up to n, or perfect squares, or ... - test if integer is prime - print "line" of *'s that is given width - compute factorial - loop through an array and do something with each item * If's and else if's * - given number grade print letter grade - check string to see if a good password, or valid phone number, or ... * One while loop * - ask for user input until "done" typed, or until type all caps, or ... - convert from decimal to base 2, 8, or 16 * Nested for loops * - print all primes in a range, or composites, or primes that are 1 mod 4, or ... - print rectangle of *'s, or triangle, or circle, or ... * 2 dimensional arrays * - add matrices - simple map and movement - 2d array of characters, int row and col for position * files * - read from file and print to screen, or count lines, or count letters, or count ... - read from file, some simple change, and write to file - read/write file one character at a time - read/write file one line at a time * recursion * - anything that takes one for loop or while loop * command-line arguments * - read them as numbers, compute sum - read them as strings, and print in reverse order * strings * - ** Algorithms & DS ** * sorting * - selection sort - insertion sort - bubble sort - merge sort * search * - linear search - binary search * sorted and unsorted arrays * - lookup (binary or linear search) - insert - remove * linked list * - traverse, and either print or search for an item - insert onto head or tail, remove from head or tail - use to implement queue (insert/push onto tail, remove/pop from head) - use to implement stack (insert/push and remove/pop from head) - singly linked vs doubly linked * hash table * - simple hash function - lookup - insert - remove * binary search tree * - lookup - insert - remove * heap * - find-min - insert - extract-min