0% found this document useful (0 votes)
29 views3 pages

DSA Write Up Questions

The document outlines a series of assignments related to data structures and algorithms, covering topics such as hashing, binary search trees, expression trees, and dictionary implementation using BST. Each assignment includes specific tasks such as constructing data structures, performing operations, and analyzing efficiency. The assignments also involve practical implementations and comparisons of different data structures and algorithms.

Uploaded by

Suraj Surve
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)
29 views3 pages

DSA Write Up Questions

The document outlines a series of assignments related to data structures and algorithms, covering topics such as hashing, binary search trees, expression trees, and dictionary implementation using BST. Each assignment includes specific tasks such as constructing data structures, performing operations, and analyzing efficiency. The assignments also involve practical implementations and comparisons of different data structures and algorithms.

Uploaded by

Suraj Surve
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/ 3

DSA Writeup questions

Assignment 1- Hashing
1.​ Consider a hash table of size 11 that uses open addressing with linear probing. Let
h(k) = k mod 11 be the hash function used. A sequence of records with keys 43 36 92
87 11 4 71 13 14 is inserted into an initially empty hash table, the bins of which are
indexed from zero to ten. What is the index of the bin into which the last record is
inserted?
2.​ Prepare hash table by Inserting following Elements into hash table using extendible
hashing: 16, 4, 6, 22, 24, 10, 31, 7, 9, 20, 26. Bucket Size: 3
3.​ Insert the following data in the hash table of size 10 using linear probing with
chaining by applying with replacement : 11, 33, 20, 88, 79, 98, 68, 44, 66, 24.
Calculate average number of comparisons required to search given data from hash
table.
4.​ A company's employee records are stored using a hash table with quadratic probing.
If the table size is 11, and the hash function is h(key) = key % 11, insert employee
IDs: 27, 18, 29, 38, 16, 41 and show the table after insertion.
5.​ A university wants to store student roll numbers in a hash table to manage student
records efficiently. The roll numbers are: {1201, 1315, 1423, 1517, 1672, 1783,
1905} The hash function used is: h(Roll Number)=Roll Number mod 5 . show the
table after each insertion. Use hashing with & without replacement.

Assignment 2 - Set Operations

1.​ What are functions in Python? Explain with an example?


2.​ What is the difference between python set, dictionary & tuple?
3.​ What is the difference between set difference & Symmetric set difference.
4.​ Explain what is the use of constructors & different types of constructors in python.
5.​ Create a Bus object that will inherit all of the variables and methods of the parent Vehicle
class and display it.

Assignment 4 - Binary Search Tree


1.​ Construct a BST from the numbers 55, 30, 70, 20, 40, 60, 80. Compute the height of the
BST and find a depth of 60.
2.​ Given two sequences of numbers for BST insertion:​
A. Sequence A: {40, 20, 60, 10, 30, 50, 70}
B. Sequence B: {10, 20, 30, 40, 50, 60, 70}
Construct BSTs for both sequences and compare their structures. Evaluate which BST is
more efficient for searching and justify your reasoning.
3.​ Construct a BST using the values {100, 50, 150, 25, 75, 125, 175}. Perform a mirror
transformation (swap left and right subtrees at every node). Compare the preorder,
inorder, and postorder traversals before and after mirroring. Analyze how this
transformation affects the efficiency of searching for a given key (e.g., 75).
4.​ Construct BSTs for the following two cases:
●​ Case 1: Preorder {30, 20, 10, 25, 40, 35, 50}, Inorder {10, 20, 25,
30, 35, 40, 50}
●​ Case 2: Preorder {30, 40, 50, 35, 20, 25, 10}, Inorder {10, 20, 25,
30, 35, 40, 50}​
Compare the heights of the two BSTs.Which BST structure is more efficient for
searching, and why?
5.​ Given preorder {100, 50, 25, 75, 150, 125, 175} and inorder {25, 50,
75, 100, 125, 150, 175}, construct the BST.Determine the postorder traversal of
the BST.

Assignment 4 - Expression Tree


1.​ Explain the expression tree with suitable examples.
2.​ Given the prefix expression +--a*bc/def, construct the corresponding expression
tree step by step. Represent the final tree structure. Show stack contents in every step
3.​ Given the prefix expression a b + c d e + * * , Construct the corresponding expression
tree step by step. Represent the final tree structure. Show stack contents in every step
4.​ Explain the delete operation on Binary Tree.
5.​ Convert given A + B * C + D Infix expression to postfix

Assignment 5 - Dictionary implementation using BST


1.​ Explain how strings are compared while constructing BST?
2.​ ["apple", "apply", "apricot", "bat", "batch", "battery", "cat", "cater", "dog", "dolphin",
"elephant", "eagle"] by using above 12 words create BST step by step. Show ASCII
comparisons and find height of BST.
3.​ What is balanced vs unbalanced BST?
4.​ Compare the search complexity of finding a keyword in a balanced BST vs. Skewed
BST. Given a worst-case skewed BST, how does it affect the maximum number of
comparisons required?
5.​ ["mango", "banana", "peach", "apple", "grape", "orange", "kiwi", "pineapple",
"watermelon", "cherry", "lemon", "blueberry", "strawberry", "fig", "date"] . Construct BST
& find Preorder, Inorder & postorder traversal of tree.
Assignment 6 - BFS & DFS on Graph
Assignment 7- Implementation of a MST using Prim’s Algorithm
Assignment 8- Implementation of an Optimal Binary search tree Data Structure
Assignment 9 - Implementation of a Height Balance Tree Data Structure
Assignment 10- Implementation of a Priority Queue as ADT
Assignment 11- Implementation of sequential file organization concept using cpp
Assignment 12- Implementation of a direct access file

You might also like