Algorithm Programming
This book contains the theoretical foundations for programming algorithm practicum for the Computer Engineering department at UI.
Module 2 - Linked List
Theoretical basics of Linked Lists, their types, benefits, and example code.
Part 1 - Understanding Linked List
Definition of Linked List A Linked List is a linear data structure consisting of elements called...
Part 2 - Types of Linked List
Types of Linked Lists Based on the structure of linked lists, they can be classified into severa...
Part 3 - Searching
1. Searching in a Custom Singly Linked List #include <bits/stdc++.h> using namespace std; //...
Part 4 - Manual VS STL List
A doubly linked list is a data structure where each node contains a pointer to the next and previ...
Module 4 - Merge Sort and Quick Sort
1. Understanding Merge Sort
What is Merge Sort? Merge Sort is an efficient, comparison-based sorting algorithm that uses a "d...
2. Merge Sort in C++
This section explains how the "divide and conquer" strategy of Merge Sort is implemented in C++. ...
3. Understanding Quick Sort
What is Quick Sort? Quick Sort is a highly efficient, comparison-based sorting algorithm that als...
4. Lomuto Quick Sort in C++
This section explains how the "divide and conquer" strategy of Quick Sort is implemented in C++. ...
5. Hoare Quick Sort in C++
This section explains how the "divide and conquer" strategy of Quick Sort is implemented in C++. ...
Module 5 - Advanced Sorting Algorithms & The Heap Data Structure
1. Motivation: The Quest for the Ideal Sorting Algorithm
In our study of advanced sorting algorithms, we have explored powerful techniques that offer sign...
2. Prerequisite: An Introduction to the Tree Data Structure
Before we can understand the Heap, we must first be familiar with its underlying structure: the T...
3. The Heap Data Structure
Now that we understand the concept of a binary tree, we can define a Heap. A Heap is a specialize...
4. Core Operations and the Heap Sort Algorithm
The Heap Sort algorithm is a two-phase process that masterfully uses the properties of the Max-He...
5. The Heap in Practice: The C++ Standard Template Library (STL)
While understanding how to build Heap Sort from scratch is crucial for algorithmic knowledge, in ...
Module 6 - Tree
Module 7 - Hash Map
1. Main Concept of Hash Map
Hashing is the process of converting data of any size (like a string, number, or object) into a f...
2. Collision Handling
A Collision occurs when two or more different keys produce the same hash value (index). For examp...
3. Load Factor and Rehashing
3.1. Load Factor (λ) The Load Factor (λ) is a measure of how full the hash table is. It is a crit...
4. Example: Full Manual Implementation
This chapter combines all the concepts from Chapters 2 and 3 into a single, complete MyHashMap cl...
5. Hashing Implementation with C++ STL
In C++, instead of creating a Hash Table manually, you could use Standard Template Library (STL)....
6. Custom Struct Keys
A notable limitation of the C++ STL's std::unordered_map and std::unordered_set is their inabilit...
Module 8 - Graph, Stack, and Queue
1. Graphs Concept
A Graph is a non-linear data structure consisting of nodes and edges. The nodes are formally cal...
2. Graph Representations
A graph is an abstract concept. To store one in a computer's memory, we must translate this idea ...
3. Stack and Queue
Before diving into graph traversal, we must understand the two key data structures that power the...
4. Graph Traversal: Breadth-First Search (BFS)
Breadth-First Search (BFS) is a traversal algorithm that explores the graph "level by level." It ...
5. Graph Traversal: Depth-First Search (DFS)
Depth-First Search (DFS) is a traversal algorithm that explores the graph by going as "deep" as p...
6. Example: Full Code Implementation
This chapter combines all the concepts into a single Graph class using the C++ STL for the adjace...