Skip to content

About

Design and Analysis of Algorithms (CS-2009, FAST-NUCES): 22 lectures, assignments with C++ solutions, a Merkle tree, treap and heap project, past papers and study notes.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design and Analysis of Algorithms

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.

Course: Algorithms FAST-NUCES CS-2009 Language: C++ Topics: Sorting, Graphs, DP Website


Live Links

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

Table of Contents


Course Overview

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.

Topics Covered

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.

Repository at a Glance

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

Lectures

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

Assignments, Project and Papers

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

Books and Notes

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

Large Files

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

Folder Structure

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

Screenshots

1. Repository Folder Structure

Repository Folder Structure

2. Lecture 2 – Big-Oh Notation

Lecture 2 – Big-Oh Notation

3. Lecture 3 – Running Time of Insertion Sort

Lecture 3 – Running Time of Insertion Sort

4. Lecture 4 – Recursion Tree for T(n) = 2T(n/2) + cn

Lecture 4 – Recursion Tree for T(n) = 2T(n/2) + cn

5. Lecture 4 – Master Method: Three Common Cases

Lecture 4 – Master Method: Three Common Cases

6. Lecture 4 – Merge Sort Example

Lecture 4 – Merge Sort Example

7. Lecture 5 – Quick Sort Partitioning

Lecture 5 – Quick Sort Partitioning

8. Lecture 6 – MAX-HEAPIFY Example

Lecture 6 – MAX-HEAPIFY Example

9. Lecture 7 – Counting Sort Example

Lecture 7 – Counting Sort Example

10. Lecture 8-9 – Naïve String Matching Algorithm

Lecture 8-9 – Naïve String Matching Algorithm

11. Lecture 8-9 – The Rabin–Karp Algorithm

Lecture 8-9 – The Rabin–Karp Algorithm

12. Lecture 10 – String Matching with Finite Automata

Lecture 10 – String Matching with Finite Automata

13. Lecture 11 – KMP Prefix Function

Lecture 11 – KMP Prefix Function

14. Lecture 12 – Adjacency List and Matrix

Lecture 12 – Adjacency List and Matrix

15. Lecture 13 – Breadth-First Search

Lecture 13 – Breadth-First Search

16. Lecture 14 – Prim's Minimum Spanning Tree

Lecture 14 – Prim's Minimum Spanning Tree

17. Lecture 15 – Dijkstra's Algorithm

Lecture 15 – Dijkstra's Algorithm

18. Lecture 16 – Bellman–Ford Example

Lecture 16 – Bellman–Ford Example

19. Lecture 17 – Constructing a Huffman Tree (Greedy)

Lecture 17 – Constructing a Huffman Tree (Greedy)

20. Lecture 18 – Recursive Fibonacci and Why DP Helps

Lecture 18 – Recursive Fibonacci and Why DP Helps

21. Lecture 19 – Matrix-Chain Multiplication Table

Lecture 19 – Matrix-Chain Multiplication Table

22. Lecture 20 – 0/1 Knapsack by Dynamic Programming

Lecture 20 – 0/1 Knapsack by Dynamic Programming

23. Lecture 21 – Longest Common Subsequence

Lecture 21 – Longest Common Subsequence

24. Lecture 22 – Floyd–Warshall

Lecture 22 – Floyd–Warshall

25. Assignment 3 – KMP Search in C++

Assignment 3 – KMP Search in C++

26. Practice – String Matching Program in C++

Practice – String Matching Program in C++

27. Assignment 1 – Problem Statement

Assignment 1 – Problem Statement

28. Project – Treaps Comparative Case Study

Project – Treaps Comparative Case Study

29. Handwritten Algorithm Notes

Handwritten Algorithm Notes

30. Sessional I – Solution

Sessional I – Solution

Running the Code

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 .sln file (for example Assignments/22i_2327_A3_Sec_D/Q_01_Sol/Q_01_Sol.sln or Practice 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, so g++ or clang++ builds it directly.
  • Build folders (.vs, x64, Debug) are not stored in the repository; they are recreated on the first build.

License

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.

Author

Mohammad Rohaan – BS Computer Science, FAST-NUCES

If this helped you with Algorithms, a ⭐ on the repository is appreciated.

About

Design and Analysis of Algorithms (CS-2009, FAST-NUCES): 22 lectures, assignments with C++ solutions, a Merkle tree, treap and heap project, past papers and study notes.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages