Data Structures and Algorithms
by Sarfraz Raza
Other related course:
ITC 2017: https://sites.google.com/view/itc-ucp-2017
PF/OOP 2018: https://sites.google.com/view/pf-ucp-2018/
DM 2017: https://sites.google.com/view/ds-ucp-2017/home
DSA 2017: https://sites.google.com/view/dsa-ucp2017
Algo 2017: https://sites.google.com/view/algo-ucp-2017/home
Algo 2019: https://sites.google.com/view/algo-ucp-2019/home
Algo 2020: https://sites.google.com/view/algo-ucp-2020/home
Algo 2021: https://sites.google.com/view/algo-itu-2021/home
The Central Question of Data structures
We started with variable data structures
Their pros
Their limitation
We moved to static arrays
Their applications
Sorting
Searching
Their issues
Dynamic Arrays
Growable Array with fixed addition
Its push_back function time complexity analysis
Vector Implementation
Its push_back function time complexity analysis
Arraylist implementation
Its push_back function time complexity analysis (exercise)
(Unfortunately we lost this lectures recording, you may see the previous year recording)
Dynamic Arrays
Growable Array with fixed addition
Its push_back function time complexity analysis
Vector Implementation
Its push_back function time complexity analysis
Arraylist implementation
Its push_back function time complexity analysis (exercise)
Using Templates
Stack Data Structures
FIXED SIZE STACK
Its ADT (multiple implementations)
Push/Pop/To multiple versions
Applications of STACK
Decimal to any base converter
Dynamic Stack
Using Vector implementation
Stack Data Structures
Discussion on Parenthesis balancing problem
Maintaining Minimum and Maximum in Stack
Maintaining three stacks
Maintaining one stack of augmented entry
QUEUE Data Structures
Circular Queue
Queue Using Two Stacks
Steueue
Dequeue
Which algorithm is faster
Big-O (Upper Bound)
Logarithmic function
little o
Big Omega
Little Omega
Big Theta
Introduction to recursion
Call stack and recursion
Sum(N)
Power(2,N)
Decimal to binary converter
GCD with a powerful technique
Fast Power
Fibonacci
Fibonacci with Dynamic Programming(Memoization )
The problems with Vector Data Structures
Building the Train Data Structures
Printing the Train
Inserting in the Train
Why Tail Pointer is needed?
Add Front/Tail
Discussion on Remove
Revising Forward Linked List
Handaling important cases
Compact code vs clear code
Introduction to iterators
Introduction to subclasses
Implementing forward Iterator as a subclass of list
The auto keyword
Revision of Iterators
Insert at nth index (but it takes O(n))
Insert at nth index (O(1) solution)
Introduction to Doubly Linked List
Implementing a Doubly linked list
Real-life Applications of a Doubly Linked list(chrome tabs, operating system process management, etc)
Mini Project Discussion
Discussion about our journey in data structures.
problem with the linked list
Introduction to BSTree
Implementing BSTree class
Insert()
Search()
BSTiterators()
SpecialPrint()
Discussion of pros and cons of different data structures
Use of abstraction in OOP
BSTree Traversals
Inorder Traversal
Preorder Traversal
Postorder Traversal
Solving problems using traversals
FindTreeSize()
CountLeaves()
EqualTree()
PicEqual()
Val&PicEqual()
Height()
Discussion of assignment
Printing Traversals
PrintallLeaves()
Print all nodes at K distance from the root
PrimeCount()
EvenCount() and OddCount()
PicEqual()
Val&PicEqual()
DeleteAllLeaves()
Recursive TreeMinimum() and TreeMaximum()
Discussion about BSTree Assignment
Section I
Discussed 25 questions
Section II
Discussed 3 questions
Section III
Discussed 11 questions
Introduction to the Binary Heap data structure
Max Heap
Min Heap
Insert()
Internal storage
Increase/Decrease Key
Height and Depth in a Binary Heap
Sorting using Heap
An interesting interview question
Disk Sort
Discussion about the DOS project idea
Discussion about the DOS shell implementation
Discussion about providing a text editor in the DOS Shell to edit files
C++ implementation of DOS shell and text editor
Sorting large data(Problem limited RAM)
The Idea of loading data in chunks
Making Struct Fval
Using Priority Queue
The story of data structures
Problem with the binary tree-O(n)
Introduction to the AVL tree
Balanced binary tree
Zig operation
Zag operation
Complexity Analysis
AVL Trees
Three cases of Insertion
Splay Trees
Insertion
Deletion
Skip List
Deterministic Skip List
Randomized Skip List
Theoretical and Practical Analysis
Skip List visualization
Node class
Skip List class
Underlying structure
Insert in Skip List
Level Insertion
Node Insertion
Maintaining links
Search in Skip List
Delete in Skip List
Deterministic Skip list(revision)
Treaps
Huffman Coding
Coding
Decoding
Huffman Code
Adjacency Matrix
Adjacency List
Undirected Graph
Discussion about Machine Learning
Discussion about CRLS Algo Book
Discussion about memory models
Disk Read/Write
Binary Tree with keys
Height if B-Tree
B-Tree Search
B-Tree Insertion/Deletion
B-Tree Visualization
The Search Problem
Applications
Dictionaries
Comparing different Implementations
Hash Tables
Collision
Handling a Collision using chaining
Analysis
Hash Functions
Open Addressing
Linear probing
Quadratic Probing
Double Hashing
Universal hashing introduction
Basic Assumption
Existential Proof
Universel hash function for Strings
C++ implementation of:
Finding the frequency of each character in the file
Building the Huffman tree
Assigning code to each character
Encoding the file
Decoding the file