0% found this document useful (0 votes)
350 views4 pages

CSC301 Data Structures Notes

The document provides comprehensive lecture notes on Data Structures, covering definitions, classifications, and examples of various data structures including arrays, linked lists, stacks, queues, trees, graphs, and hash tables. It also discusses searching and sorting algorithms, time and space complexity, and practical applications of data structures. Additionally, it offers exam tips for mastering the subject.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
350 views4 pages

CSC301 Data Structures Notes

The document provides comprehensive lecture notes on Data Structures, covering definitions, classifications, and examples of various data structures including arrays, linked lists, stacks, queues, trees, graphs, and hash tables. It also discusses searching and sorting algorithms, time and space complexity, and practical applications of data structures. Additionally, it offers exam tips for mastering the subject.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CSC301 - Data Structures: Full Semester Notes

CSC301 - Data Structures


Full Semester Lecture Notes + Examples + Exam Practice

Week 1-2: Introduction to Data Structures


Definition:
A data structure is a specialized format for organizing, processing, retrieving, and storing data.

Why Important:
Choosing the right data structure improves efficiency and reduces memory usage.

Classification:
1. Primitive Data Structures: int, char, float, boolean.
2. Non-Primitive Data Structures:
- Linear: Array, Linked List, Stack, Queue.
- Non-Linear: Tree, Graph.
- Hash-based: Hash Tables.

Example in Java:
int[] arr = {1,2,3,4};
System.out.println(arr[2]); // Output: 3

Week 3-4: Arrays and Linked Lists


Arrays:
- Fixed size, contiguous memory.
- Fast access (O(1)) but costly insertion/deletion (O(n)).

Linked Lists:
- Dynamic size, each node stores data + pointer(s).
- Slower access (O(n)) but fast insert/delete.

Types:
- Singly Linked List
- Doubly Linked List
- Circular Linked List

Java Node Example:


class Node {
int data;
CSC301 - Data Structures: Full Semester Notes

Node next;
Node(int d) { data = d; next = null; }
}

Week 5: Stacks and Queues


Stack:
- LIFO principle.
- Operations: push(), pop(), peek().

Queue:
- FIFO principle.
- Operations: enqueue(), dequeue(), peek().

Variants: Circular Queue, Priority Queue, Deque.

Example:
Stack<Integer> stack = new Stack<>();
stack.push(10);
stack.pop();

Week 6-7: Trees


Tree Basics:
- Hierarchical, root node at top.
- Binary Tree: Max 2 children per node.
- Binary Search Tree: Left < Root < Right.

Traversals:
- Inorder (LNR)
- Preorder (NLR)
- Postorder (LRN)

Example Diagram:
10
/ \
5 15

Week 8-9: Graphs


Graph:
- Vertices + Edges.
CSC301 - Data Structures: Full Semester Notes

- Directed/Undirected, Weighted/Unweighted.

Representations:
- Adjacency Matrix
- Adjacency List

Algorithms:
- DFS
- BFS
- Dijkstra
- Prim's, Kruskal

Week 10: Hash Tables


Hash Table:
- Stores data as key-value pairs.
- Uses hash function to compute index.
- Handles collisions via chaining or open addressing.

Example:
HashMap<String, Integer> map = new HashMap<>();
map.put('age', 25);

Week 11-12: Searching and Sorting


Searching:
- Linear Search: O(n)
- Binary Search: O(log n)

Sorting:
- Bubble, Selection, Insertion: O(n^2)
- Merge, Quick, Heap: O(n log n)

Week 13: Time and Space Complexity


Big-O Notation:
- O(1) Constant
- O(log n) Logarithmic
- O(n) Linear
- O(n log n) Log-linear
- O(n^2) Quadratic
CSC301 - Data Structures: Full Semester Notes

Week 14: Applications + Exam Tips


Applications:
- Arrays: game boards.
- Linked Lists: playlists.
- Stacks: undo feature.
- Queues: OS scheduling.
- Trees: file systems.
- Graphs: maps.
- Hash Tables: databases.

Exam Tips:
1. Practice tracing algorithms.
2. Learn differences between data structures.
3. Understand time complexities.
4. Be able to implement each DS in code.

You might also like