FAST-NUCES · BS Computer Science · Algorithms

Design and Analysis of Algorithms

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
22Lectures
5C++ sources
28PDF documents
14Study notes
45Note images
138Files in total

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.

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.

Lectures

22 lectures from complexity analysis to Floyd–Warshall. Every file opens on GitHub, where PDFs preview in the browser.

01IntroductionWhat an algorithm is, design and analysis, introduction to complexity · 2 files
02Complexity analysisCounting steps, growth of functions, Big-O, Big-Ω and Big-Θ · 1 files
03Insertion sortInsertion sort, best, worst and average case analysis · 1 files
04Recursion and recurrencesRecursion, iteration method, recursion trees, master method, merge sort analysis · 5 files
05Quick sortPartitioning, best, worst and average running time of quick sort · 1 files
06Heap sortHeaps, MAX-HEAPIFY, BUILD-MAX-HEAP and heapsort · 1 files
07Sorting in linear timeLower bound for comparison sorting, counting sort, radix sort, stability · 1 files
08-09String matching IExact matching, the naïve algorithm and Rabin–Karp · 1 files
10String matching IIString matching with finite automata · 1 files
11String matching IIIKnuth–Morris–Pratt and the prefix function · 1 files
12Graph theory IGraph terms and adjacency-list and adjacency-matrix representations · 1 files
13Graph theory IIBreadth-first and depth-first search · 1 files
14Minimum spanning treesKruskal's and Prim's algorithms · 1 files
15Dijkstra's algorithmSingle-source shortest paths with non-negative weights · 1 files
16Bellman–FordShortest paths with negative weights and negative-cycle detection · 1 files
17Greedy algorithmsActivity selection and Huffman codes · 1 files
18Dynamic programmingFibonacci, memoisation and bottom-up tables · 1 files
19Matrix-chain multiplicationOptimal parenthesisation with dynamic programming · 1 files
200/1 knapsackKnapsack by brute force and by dynamic programming · 1 files
21Longest common subsequenceBrute force, optimal substructure and the LCS table · 1 files
22All-pairs shortest pathsBellman–Ford review and Floyd–Warshall · 1 files

Books & Notes

Handwritten notes, my study notes in Markdown and the course textbooks.

NStudy notesHandwritten notes and my Markdown notes on knapsack, DP, graphs, greedy, Huffman and more · 53 files

Open Notes on GitHub · 53 files

BTextbooksCormen et al. (CLRS, 3rd edition) and Levitin · 2 files

Assignments, Project & Papers

Assignments with my C++ solutions, the semester project, past papers and practice problems.

AAssignmentsAssignment 1, 2 and 3 statements and my solutions · 5 files
A3Assignment 3 codeString matching, text similarity, multi-pattern automaton and compression in C++ (Visual Studio) · 17 files
PProjectMerkle trees, treaps and heaps project statements and rubrics · 7 files
DProject dataRoad-network data files for the heap part · 3 files
EPast papersSessional I solution and past final exams with solutions · 10 files
PPPractice problemsRecurrence and DP practice, worked problems and a string matching program · 11 files

Folder Structure

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

Get the Files

Clone everything with Git, or download the ZIP from the Live Links.

Clone the repository

Command
git clone https://github.com/rohaan2802/Algorithm_Repo.git

Build a C++ solution (any compiler)

Command
g++ -std=c++17 -O2 "Assignments/22i_2327_A3_Sec_D/Q_01_Sol/Source.cpp" -o q1 && ./q1

Each .sln file opens its project in Visual Studio (Desktop development with C++). Build output folders such as .vs, x64 and Debug are not stored; Visual Studio recreates them on the first build.

License

Lecture slides, exam papers, assignment 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 – see LICENSE. My own notes, code and the organisation of this repository are free to use for study.