Repository contains notes, code etc related to algo and ds. Purpose is mostly to serve self - to better understand the space. Hope it helps others as well.
Problem specifies, in general terms, the relation between the provided input and the expected output. For example, given input a1, a2, …, an output in sorted order
Some of the problems found in textbooks:
Input --> Algorithm (computational instructions) --> Output
Algorithms are implemented using a programming language. It is compiled into an executable which is then run on a computer. The computer provides the resources - CPU, Memory etc.
Algorithm (Program)
Input ---> ------------------------------------ ---> Output
Computer (CPU, Memory, etc.)
Algorithm’s efficiency is measured in time and space. Less usage of CPU and memory more efficient the algorithm. Each problem can have multiple algorithm solutions. For example, sorting can be done by bubble sort, selection sort, insertion sort, merge sort, quick sort, heap sort, etc. For a given instance, some algorithms are more efficient than others, meaning their usage of CPU and Memory is lesser.
Interestingly one wants to know what’s the lower (best case) bound and what’s the upper (worst case) bound of resource usage. These are mathematically denoted as Ω (Omega) and O (Big O) respectively. Θ (Theta) indicates both upper and lower bounds.
Correctness of algorithm has to be proven. This is usally done using mathematical tools and reasoning.
Markdown is suitable for blogging. There are tools that convert md files to web pages. Don’t want to be bothered about HTML and CSS unless required. Markdown is flexible - can include HTML, and CSS if required.
[1] Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2001). Introduction to algorithms (3rd ed.). MIT Press.