Whirlwind Tour
Non-Programmer's Tutorial
- Write a program that prints "Hello World" to the screen.
- Write a program that asks the user for their name and greets them with their name "Hello username".
- Do some easy calculations
(+,-,*,/,%,**,square root)
. - Write a program that asks the user for a number n and prints the sum of the numbers 1 to n
- Modify the previous program such that only multiples of three or five are considered in the sum, e.g. 3, 5, 6, 9, 10, 12, 15 for n=17
- Write a program that asks the user for a number n and gives them the possibility to choose between computing the sum and computing the product of 1..n.
- Write a program that prints all prime numbers.
- Write a guessing game where the user has to guess a secret number. After every guess the program tells the user whether their number was too large or too small. At the end the number of tries needed should be printed.
- Write a program that prints the next 20 leap years.
- Write a program the checks if a given bank account number (IBAN) or book number (ISBN) is correct according to their respective checksums.
- Write a function that returns the largest element in a list.
- Write function that reverses a list, preferably in place.
- Write a function that checks whether an element occurs in a list.
- Write a function that returns the elements on odd positions in a list.
- Write a function that computes the running total (=prefix sum) of a list.
- Write a function that tests whether a string is a palindrome.
- Write three functions that compute the sum of the numbers in a list: using a for-loop, a while-loop and recursion.
- Print all square numbers [1,4,9,16,25] and all n^n numbers [1,2,27,256,3125] up to a certain number.
- Write a function that concatenates two lists. [a,b,c], [1,2,3] → [a,b,c,1,2,3]
- Write a function that combines two lists by alternatingly taking elements, e.g. [a,b,c], [1,2,3] → [a,1,b,2,c,3].
- Write a function that merges two sorted lists into a new sorted list. [1,4,6],[2,3,5] → [1,2,3,4,5,6]. You can do this quicker than concatenating them followed by a sort.
- Write a function that rotates a list by k elements. For example [1,2,3,4,5,6] rotated by two becomes [3,4,5,6,1,2].
- Write a function that computes the list of the first 100 Fibonacci numbers.
- Write a function that takes a number and returns a list of its digits.
- Implement the following sorting algorithms: Selection sort, Insertion sort
- Implement binary search.
- Write function that translates a text to Pig Latin and back. English is translated to Pig Latin by taking the first letter of every word, moving it to the end of the word and adding ‘ay’. “The quick brown fox” becomes “Hetay uickqay rownbay oxfay”.
- Write a function that takes a list of strings an prints them, one per line, in a rectangular frame. For example the list ["Hello", "World", "in", "a", "frame"] gets printed as:
*********
* Hello *
* World *
* in *
* a *
* frame *
*********
- Print a christmas tree, given its width. If width=7:
*
***
*****
*******
*
- Write a program, that takes numbers as words (one, two, ..., nine) and translates them to german words (eins, zwei, ..., neun).
- Given a set of supermarket items ("apple", "banana") and their prices in EUR (2.5, 3). Print the sum of a list of items. For example ["apple", "apple", "banana", "apple"] should print 10.50 EUR.
- n! (factorial)
- n(i+1) = n(i) + n(i-1) (Fibonacci sequence)
- Binomial Coefficient
- Reverse a string
- Merge sort
- Quick sort
- Towers of Hanoi
- Euclidean algorithm
- List all files of a folder and its subfolders
- Graph: depth-first search
- Graph: flood fill
- Tree: In-order, Pre-order, Post-order traversal
- Bresenham
- Runlength Encoding
- Huffman Encoding
- Lempel-Ziv-Welch
- Wagner Fischer Algorithm (Edit Distance)
- Boyer Moore
- Knuth Morris Pratt
- Miller Rabin
- Scheduling: Johnson's Rule
- k-d tree
- Bloom Filters
- Insertion Sort
- Selection Sort
- Merge Sort
- Quick Sort
- Heap Sort
- Radix Sort
- Bucket Sort
- Stack
- ArrayList
- LinkedList
- Binary Search Tree
- Heap / Priorityqueue
- AVL Tree
- B Tree
- Skiplist
- Graph (adj. matrix or list)
- DFS / BFS
- Dijkstra
- A*
- Bellman-Ford
- Floyd-Warshall
- Johnson
- Kruskal / Prim
- Travelling salesman
- Vertex cover / Independent set
- Bin packing
- Knacksack packing
- Graph coloring
Wikipedia list: link