NOTE: These algorithms I have implemented with python for fun are inspired by the stanford algo class on coursera https://class.coursera.org/algo-005 (Algorithms: Design and Analysis, Part 1 by: Tim Roughgarden). They were often used to solve programming assignments. check them out for reference or add more algorithms.
NOTE: If you are a current student of this course, please make sure to attempt the problems yourself first. Best part of learning is coming up with the solution yourself!
Algorithms in this pack
- merge sort
- O(nlogn) inversion counter
- this algorithm performs with O(nlogn) by peggybacking on merge sort!
- Finding second largest number in an array with at most n + logn - 2 comparisons!
- for this algo tourny algo is the main inspiration. Another divide and conquer algo.
- Finding max element in unimodal array in logn
- inspired by bisection method if you think max element as f(x)=0 aka root point.
- Find if a[i] = i, in a sorted, distinct (increasing order) n elements array