0% found this document useful (0 votes)
190 views10 pages

Data Structures Overview: Lectures 1-45

Uploaded by

chwahabg22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
190 views10 pages

Data Structures Overview: Lectures 1-45

Uploaded by

chwahabg22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

📘 CS301 – Data Structures (Short Notes: Lectures 1–45)

Lecture 1 – Introduction to Data Structures

Data Structures: Way to organize data for efficiency.

Selecting DS: Based on problem, operations, and constraints.

Philosophy: Every DS has cost (space, time, effort).

Goals: Learn arrays, lists, stacks, queues, trees, graphs.

Arrays: Contiguous memory, fixed size.

List DS: Collection of items with order; supports create, insert, delete, update.

Lecture 2 – List Implementation

Implementation using Array.

Operations: add, next, remove, find, get, update, length, back, start, end.

Analysis: Add/remove costly (shifting), find = O(n).

Limitation: Fixed size.

Linked Memory: Overcomes array size limits.


Lecture 3 – Linked List Basics

Linked List in Memory: Node = (data + next).

Head: Points to first node.

Operations: Add node, move next, delete node.

Implementation in C++: Node and List classes.

Lecture 4 – Linked List Operations

Functions: add, get, next, remove.

Delete: Adjust pointers.

Advantages: Dynamic size, insertion/deletion easy.

Disadvantages: More memory, slower access.

Lecture 5 – Doubly Linked List

Node: data + prev + next.

Operations: Insert, delete in both directions.

Benefits: Traverse both ways.


Drawback: Extra memory.

Lecture 6 – Circular Linked List

Definition: Last node points to head.

Advantages: Continuous traversal.

Used in: Round-robin scheduling.

Lecture 7 – Stack Basics

Stack: LIFO (Last In, First Out).

Operations: push, pop, peek.

Applications: Undo, expression evaluation, recursion.

Lecture 8 – Stack Implementation

Array-based: Fixed size.

Linked List-based: Dynamic.

Overflow/Underflow: Full/empty conditions.


Lecture 9 – Expression Evaluation

Expression Forms: Infix, Prefix, Postfix.

Conversions: Infix → Postfix (using stack).

Evaluation: Postfix evaluation using stack.

Lecture 10 – Queue Basics

Queue: FIFO (First In, First Out).

Operations: Enqueue, Dequeue.

Applications: Scheduling, buffering.

Lecture 11 – Circular Queue

Problem: Linear queue wastes space.

Circular Queue: Rear wraps to front.

Full: (rear+1)%size == front.

Empty: front == -1.

Lecture 12 – Priority Queue


Definition: Elements with priorities.

Types: Ascending, descending.

Implementation: Arrays, linked lists, heaps.

Lecture 13 – Recursion

Definition: Function calls itself.

Needs base case.

Examples: Factorial, Fibonacci.

Pros: Elegant, divide & conquer.

Cons: Stack overhead.

Lecture 14 – Searching

Linear Search: O(n).

Binary Search: Requires sorted array, O(log n).

Lecture 15 – Sorting Basics


Selection Sort: O(n²).

Bubble Sort: O(n²).

Insertion Sort: O(n²).

Lecture 16 – Advanced Sorting

Merge Sort: Divide & Conquer, O(n log n).

Quick Sort: Pivot-based, avg O(n log n), worst O(n²).

Lecture 17 – Trees Basics

Tree: Hierarchical DS.

Terminology: Root, leaf, parent, child, height, level.

Binary Tree: Each node ≤ 2 children.

Lecture 18 – Tree Traversal

Inorder: L → Root → R.

Preorder: Root → L → R.

Postorder: L → R → Root.
Lecture 19 – Binary Search Tree (BST)

Definition: Left < Root < Right.

Operations: Insert, search, delete.

Lecture 20 – Deletion in BST

Cases:

Leaf → remove.

One child → replace with child.

Two children → replace with inorder successor.

Lecture 21–24 – Sorting Detailed

Heap Sort: O(n log n), uses heap.

Radix Sort: Non-comparison sort.

Counting Sort: For small range.

Lecture 25–27 – Advanced Trees


Threaded Binary Trees: Faster inorder traversal.

Expression Trees: Internal nodes = operators.

Huffman Tree: Used in compression.

Lecture 28–30 – BST Applications

Balanced BST: Ensures log n operations.

Search, Min, Max in BST.

Successor/Predecessor.

Lecture 31–34 – AVL Trees

AVL Tree: Height-balanced BST.

Balance Factor: -1, 0, +1.

Rotations: LL, RR, LR, RL.

Lecture 35–36 – Heaps

Heap: Complete binary tree.

Max Heap: Parent ≥ children.


Min Heap: Parent ≤ children.

Applications: Priority queue, heap sort.

Lecture 37–38 – Hashing

Hash Table: Array + hash function.

Collisions:

Chaining.

Open addressing (linear, quadratic, double hashing).

Load factor: α = n/m.

Lecture 39–41 – Graphs Basics

Graph: G = (V, E).

Types: Directed, undirected, weighted.

Representations:

Adjacency matrix.
Adjacency list.

Lecture 42–43 – Graph Traversals

DFS (Depth First Search): Uses stack/recursion.

BFS (Breadth First Search): Uses queue.

Applications: Shortest path, connectivity.

Lecture 44 – Graph Algorithms

Dijkstra’s Algorithm: Shortest path (weighted).

Prim’s Algorithm: Minimum Spanning Tree (MST).

Kruskal’s Algorithm: MST using union-find.

Lecture 45 – Review

Revision of all DS: Arrays, Linked Lists, Stacks, Queues, Trees, BST, AVL, Heap, Hashing, Graphs.

Analysis: Time/space complexity.

Practical Use: Choose best DS for given problem.

You might also like