Design and Analysis of Algorithms (CS-2009) · FAST-NUCES · BS Computer Science
My Design and Analysis of Algorithms course work – 22 lectures, assignments with C++ solutions, a data-structures project, past papers, practice problems and study notes.
| What | Link |
|---|---|
| Repository | https://github.com/rohaan2802/Algorithm_Repo |
| Website (GitHub Pages) | https://rohaan2802.github.io/Algorithm_Repo/ |
| Download whole repository (ZIP) | https://github.com/rohaan2802/Algorithm_Repo/archive/refs/heads/main.zip |
- Course Overview
- Topics Covered
- Repository at a Glance
- Lectures
- Assignments, Project and Papers
- Books and Notes
- Large Files
- Folder Structure
- Screenshots
- Running the Code
- License
- Author
Design and Analysis of Algorithms (CS-2009) at FAST-NUCES Islamabad, Fall 2025. The repository has 22 lectures, three assignments with my C++ solutions, the Merkle tree, treap and heap project, past papers, practice problems, two textbooks and my study notes.
| Unit | Topics |
|---|---|
| Unit 1 – Analysis | Asymptotic notation, recurrences, recursion trees and the master method. |
| Unit 2 – Sorting | Insertion, merge, quick and heap sort, and counting and radix sort in linear time. |
| Unit 3 – Strings & graphs | Naïve, Rabin–Karp, automata and KMP matching; BFS, DFS, MST, Dijkstra, Bellman–Ford, Floyd–Warshall. |
| Unit 4 – Greedy & DP | Activity selection, Huffman codes, matrix-chain, 0/1 knapsack, rod cutting and LCS. |
| Item | Count |
|---|---|
| Lectures | 22 |
| Slide decks (PPT/PPTX) | 25 |
| C++ source files | 5 |
| Study notes (Markdown) | 14 |
| PDF documents | 28 |
| Note and problem images | 45 |
| Screenshots | 30 |
| Files in total | 138 |
| Lecture | Topic | Covers |
|---|---|---|
| 01 | Introduction | What an algorithm is, design and analysis, introduction to complexity |
| 02 | Complexity analysis | Counting steps, growth of functions, Big-O, Big-Ω and Big-Θ |
| 03 | Insertion sort | Insertion sort, best, worst and average case analysis |
| 04 | Recursion and recurrences | Recursion, iteration method, recursion trees, master method, merge sort analysis |
| 05 | Quick sort | Partitioning, best, worst and average running time of quick sort |
| 06 | Heap sort | Heaps, MAX-HEAPIFY, BUILD-MAX-HEAP and heapsort |
| 07 | Sorting in linear time | Lower bound for comparison sorting, counting sort, radix sort, stability |
| 08-09 | String matching I | Exact matching, the naïve algorithm and Rabin–Karp |
| 10 | String matching II | String matching with finite automata |
| 11 | String matching III | Knuth–Morris–Pratt and the prefix function |
| 12 | Graph theory I | Graph terms and adjacency-list and adjacency-matrix representations |
| 13 | Graph theory II | Breadth-first and depth-first search |
| 14 | Minimum spanning trees | Kruskal's and Prim's algorithms |
| 15 | Dijkstra's algorithm | Single-source shortest paths with non-negative weights |
| 16 | Bellman–Ford | Shortest paths with negative weights and negative-cycle detection |
| 17 | Greedy algorithms | Activity selection and Huffman codes |
| 18 | Dynamic programming | Fibonacci, memoisation and bottom-up tables |
| 19 | Matrix-chain multiplication | Optimal parenthesisation with dynamic programming |
| 20 | 0/1 knapsack | Knapsack by brute force and by dynamic programming |
| 21 | Longest common subsequence | Brute force, optimal substructure and the LCS table |
| 22 | All-pairs shortest paths | Bellman–Ford review and Floyd–Warshall |
| Item | Folder | Contents |
|---|---|---|
| A | Assignments | Assignment 1, 2 and 3 statements and my solutions |
| A3 | Assignment 3 code | String matching, text similarity, multi-pattern automaton and compression in C++ (Visual Studio) |
| P | Project | Merkle trees, treaps and heaps project statements and rubrics |
| D | Project data | Road-network data files for the heap part |
| E | Past papers | Sessional I solution and past final exams with solutions |
| PP | Practice problems | Recurrence and DP practice, worked problems and a string matching program |
| Folder | Contents |
|---|---|
| Study notes | Handwritten notes and my Markdown notes on knapsack, DP, graphs, greedy, Huffman and more |
| Textbooks | Cormen et al. (CLRS, 3rd edition) and Levitin |
Every file is under GitHub's 100 MB limit, so everything is in the repository and no release is needed. The biggest files are:
| File | Size |
|---|---|
| ALGO_PROJECT/Heap Part Data/Chongqing.road-d | 58.6 MB |
| Notes/Algorithm Notes.pdf | 52.7 MB |
| ALGO_PROJECT/Heap Part Data/Shanghai.road-d | 20.1 MB |
Algorithm_Repo/
│ └── Heap Part Data/ (3 files)
├── ALGO_PROJECT/ (7 files)
│ └── 22i_2327_A3_Sec_D/ (17 files)
├── Assignments/ (5 files)
├── Books/ (2 files)
├── Lecture #01/ (2 files)
├── Lecture #02/ (1 file)
├── Lecture #03/ (1 file)
├── Lecture #04/ (5 files)
├── Lecture #05/ (1 file)
├── Lecture #06/ (1 file)
├── Lecture #07/ (1 file)
├── Lecture #08-09/ (1 file)
├── Lecture #10/ (1 file)
├── Lecture #11/ (1 file)
├── Lecture #12/ (1 file)
├── Lecture #13/ (1 file)
├── Lecture #14/ (1 file)
├── Lecture #15/ (1 file)
├── Lecture #16/ (1 file)
├── Lecture #17/ (1 file)
├── Lecture #18/ (1 file)
├── Lecture #19/ (1 file)
├── Lecture #20/ (1 file)
├── Lecture #21/ (1 file)
├── Lecture #22/ (1 file)
├── Notes/ (53 files)
├── Papers/ (10 files)
├── Practice Problems/ (11 files)
│ └── String_Matching_Program/ (4 files)
├── assets/
│ ├── screenshots/ 30 images
│ ├── thumbs/ gallery previews
│ └── css/ js/ website
├── index.html
├── .gitattributes
├── .gitignore
├── .nojekyll
├── LICENSE
└── README.md
git clone https://github.com/rohaan2802/Algorithm_Repo.git
cd Algorithm_Repo
g++ -std=c++17 -O2 "Assignments/22i_2327_A3_Sec_D/Q_01_Sol/Source.cpp" -o q1
./q1- Visual Studio: open any
.slnfile (for exampleAssignments/22i_2327_A3_Sec_D/Q_01_Sol/Q_01_Sol.slnorPractice Problems/String_Matching_Program/Project1.sln) with the Desktop development with C++ workload and press Ctrl+F5. - Other compilers: each project is a single
Source.cpp, sog++orclang++builds it directly. - Build folders (
.vs,x64,Debug) are not stored in the repository; they are recreated on the first build.
Lecture slides, assignment and exam papers, project statements and textbooks belong to their instructors at FAST-NUCES and to their authors and publishers. They are shared here only for learning and revision. My own solutions, notes, code and the way this repository is organised are free to use for study. See LICENSE.
Mohammad Rohaan – BS Computer Science, FAST-NUCES
- GitHub: @rohaan2802
- Email: m.rohaanarshad@gmail.com
If this helped you with Algorithms, a ⭐ on the repository is appreciated.





























