Important_DS_Questions_Answers
Important_DS_Questions_Answers
Ans: A data structure is a way of organizing and storing data so that it can be accessed and modified efficiently.
Ans: ADT is a logical description of data and operations without considering implementation.
Ans: An array is a collection of elements identified by index or key, stored in contiguous memory locations.
Ans: A queue is a FIFO structure. Types: Simple, Circular, Priority, Double-ended (Deque).
Ans: A circular queue connects the last position to the first to utilize memory efficiently.
Ans: A linked list is a sequence of nodes where each node points to the next.
Ans: DLL is a linked list where each node has pointers to both next and previous nodes.
Ans: Hashing is converting keys to indexes using a hash function to enable fast data retrieval.
Ans: Techniques like chaining, linear probing, and double hashing resolve hash collisions.
Ans: A binary tree is a tree with each node having at most two children.
Ans: A BST is a binary tree where left < root < right.
Ans: A graph is a set of nodes connected by edges. Represented using adjacency list or matrix.
Ans: Graph traversal methods include DFS (Depth First Search) and BFS (Breadth First Search).
Ans: A heap is a binary tree with heap property. Max heap: parent >= children.
Ans: Binary search divides the sorted array to search efficiently. Time: O(log n).
Ans: Sorting arranges elements in order. Methods: Bubble, Selection, Insertion, Merge, Quick, Heap.
Ans: Bubble sort repeatedly swaps adjacent elements if they are in wrong order.
Ans: Insertion sort builds sorted list one item at a time by inserting elements.
Ans: Selection sort repeatedly selects the minimum and places it at the beginning.
Ans: Merge sort is a divide and conquer algorithm that merges sorted subarrays.
Ans: Quick sort selects a pivot and partitions the array around it recursively.
Ans: Use array to implement push/pop. Top variable tracks current element.
Ans: Each node has value and pointer; enqueue adds at rear, dequeue removes from front.
Ans: A sparse matrix has mostly zero elements. Efficiently stored using arrays or linked lists.