DS2022
DS2022
1. i) What is FIFO?
o Answer: FIFO stands for "First In, First Out," a principle in which the first
element added is the first one to be removed. Used in queue structures.
2. ii) What is a leaf node?
o Answer: A leaf node is a node in a tree data structure that has no children.
3. iii) What is BST?
o Answer: BST stands for "Binary Search Tree," a tree data structure in which
each node has at most two children, and each node’s left subtree contains
values less than the node, while the right subtree contains values greater than
the node.
4. iv) Memory space for an array is allocated in compile-time or in run time?
o Answer: Compile-time (for static arrays)
5. v) Define De-Queue.
o Answer: A De-Queue (Double-ended Queue) is a data structure where
elements can be added or removed from both ends.
6. vi) What is Backtracking?
o Answer: Backtracking is a problem-solving technique that involves searching
through all possible solutions to find a valid solution, often by undoing
choices when a dead end is reached.
7. vii) Explain about dummy header.
o Answer: A dummy header is a node at the beginning of a data structure (such
as a linked list) that does not hold meaningful data but simplifies code by
acting as a placeholder.
8. viii) Write the method of Bubble sort.
o Answer: Bubble Sort repeatedly steps through the list, compares adjacent
elements, and swaps them if they are in the wrong order. This process repeats
until the list is sorted.
9. ix) What is the difference between a PUSH and a POP?
o Answer: PUSH adds an element to the top of a stack, whereas POP removes
an element from the top of a stack.
10. x) What is a degree of a node of a tree?
o Answer: The degree of a node in a tree is the number of children it has.
11. xi) Write the full form of MST.
o Answer: Minimum Spanning Tree
12. xii) What are the disadvantages of linked list?
o Answer: Disadvantages of a linked list include higher memory usage due to
pointers, slower access times compared to arrays, and potential complexity in
code when performing certain operations.
13. xiii) Define queue full condition.
o Answer: In a circular queue, the full condition is when (rear + 1) %
MAX_SIZE == front.
14. xiv) What is rear of a queue?
o Answer: The rear of a queue is the position where the most recent element
was added.
1. a) What is Data Structure? Write down the differences between linear and
nonlinear Data Structures?
o Answer: Data Structure is a way of organizing data in a format that enables
efficient access and modification. Linear Data Structures (e.g., arrays, linked
lists) store data in a sequential manner, while Nonlinear Data Structures
(e.g., trees, graphs) store data in a hierarchical or interconnected manner,
allowing multiple paths to access data.
OR
OR
1. a) Explain Priority queue and its types. What will be the value of A(1,5) by using
Ackermann function?
o Answer: A Priority Queue is a data structure where each element has a
priority assigned to it, and elements with higher priority are dequeued before
those with lower priority. Types include:
Min-Heap: Smallest element has highest priority.
Max-Heap: Largest element has highest priority.
OR