0% found this document useful (0 votes)
7 views

DSA_Lab_Oral_Guide

The document is a comprehensive guide on Data Structures and Algorithms, detailing various assignments including Hash Tables, Set ADT, Trees, and more. Each section covers key concepts, operations, and algorithms associated with the data structures, such as collision handling in hash tables, tree types, and minimum spanning tree algorithms. It also highlights the advantages and applications of different structures, providing a clear understanding of their use cases.
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)
7 views

DSA_Lab_Oral_Guide

The document is a comprehensive guide on Data Structures and Algorithms, detailing various assignments including Hash Tables, Set ADT, Trees, and more. Each section covers key concepts, operations, and algorithms associated with the data structures, such as collision handling in hash tables, tree types, and minimum spanning tree algorithms. It also highlights the advantages and applications of different structures, providing a clear understanding of their use cases.
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/ 5

Data Structures & Algorithms Lab Practical Oral - Complete Detailed Guide

Assignment 1: Hash Tables

- Hashing: Process of mapping a large dataset to a smaller fixed-size dataset using a hash function

for quick access.

- Good Hash Function: Should be fast, uniform, minimize collisions, and be deterministic.

- Collision Handling:

- Linear Probing: Move sequentially to find an empty slot.

- Chaining: Maintain a linked list for each slot.

- Overflow: Happens when no empty slot is available even after collision resolution.

- Comparison of strategies: Chaining handles overflow better; linear probing can cause clustering.

Assignment 2: Set ADT

- Set: A collection of unordered unique elements.

- Set ADT: Abstract data type supporting operations:

- Add: Insert an element if it doesn't already exist.

- Remove: Delete a specific element.

- Contains: Check if an element exists.

- Size: Return the count of elements.

- Union, Intersection, Difference, Subset: Perform standard set operations using mathematical

rules.

- Python Sets: Implemented using hash tables internally.

Assignment 3: Trees

- Tree: A hierarchical data structure where each node has 0 or more child nodes.

- Binary Tree: A tree where each node has at most 2 children.


- BST: Left subtree contains nodes with values less than root, right subtree has greater.

- Terminologies:

- Root: Topmost node.

- Parent: Node with child nodes.

- Child: Node with a parent.

- Leaf: Node with no children.

- Height: Longest path from node to leaf.

- Depth: Distance from root to the node.

- Types of Trees: Binary, Binary Search Tree, AVL Tree, Threaded Tree, B-Tree, etc.

Assignment 4: Dictionary (BST)

- BST Dictionary: Stores keywords (key) and their meanings (value) with ordered structure.

- Insertion, Deletion, Searching:

- Insert: Recursively place smaller keys to left, larger to right.

- Delete: Handle three cases: node with 0, 1, or 2 children.

- strcmp(): Used to compare two strings for sorting and searching.

- Max Comparisons: At most equal to height of the tree (O(log n) for balanced tree).

Assignment 5: Threaded Binary Tree (TBT)

- TBT: Uses NULL pointers to point to inorder predecessor or successor.

- Advantages:

- Faster traversal.

- Saves space.

- Traversals: Preorder, Inorder, Postorder without recursion or stack.

Assignment 6: Graphs (Flight Paths)

- Graph: Consists of vertices and edges.


- Adjacency Matrix: 2D array to represent edges, good for dense graphs.

- Adjacency List: Linked list per vertex, efficient for sparse graphs.

- Applications: Network routing, social networks, maps.

- Complexity:

- Matrix: O(V^2)

- List: O(V+E)

Assignment 7: Minimum Spanning Tree (MST)

- Spanning Tree: Connects all vertices without forming cycles.

- Minimum Spanning Tree: Spanning tree with minimum edge weight sum.

- Algorithms:

- Prim's: Grows MST one vertex at a time.

- Kruskal's: Grows MST by adding the smallest edge.

- Applications: Network design (telecom, electricity).

- When to use:

- Prim's for dense graphs.

- Kruskal's for sparse graphs.

Assignment 8: Optimal Binary Search Tree (OBST)

- OBST: BST built considering access probabilities to minimize expected search cost.

- Why needed: When keys have different access frequencies.

- Algorithm: Dynamic Programming.

- Time Complexity: O(n^3).

Assignment 9: AVL Tree (Height Balanced Tree)

- AVL Tree: Self-balancing BST with balance factor -1, 0, or 1.

- Rotations:
- Single Rotation: LL, RR.

- Double Rotation: LR, RL.

- Insertion/Deletion: Rebalance using appropriate rotations.

- Advantages: Guarantees O(log n) search time.

Assignment 10: Heap (Marks)

- Heap: A complete binary tree satisfying heap property.

- Min Heap: Root is smallest.

- Max Heap: Root is largest.

- Operations:

- Insert: Add node, bubble up.

- Delete Root: Replace root with last node, bubble down.

- Applications: Priority queues, sorting (Heap Sort).

Assignment 11: Sequential File Handling (Student Info)

- Sequential File Organization: Records stored in sorted order.

- Advantages:

- Simple structure.

- Efficient for batch processing.

- Disadvantages:

- Inefficient for random access.

- Costly insertions and deletions.

Common Questions

- Linear vs Non-linear Structures:

- Linear: Array, Linked List.

- Non-linear: Tree, Graph.


- Space-Time Tradeoffs:

- Hashing is fast but uses more memory.

- Use Cases:

- AVL: When balanced fast search needed.

- TBT: When fast traversal is required.

- OBST: When keys have non-uniform access probabilities.

- Tree vs Graph:

- Tree: No cycles.

- Graph: May have cycles.

GOOD LUCK! Answer confidently!

You might also like