Computer science data structures viva question and answers.


Computer science data structures viva question and answers.

1. What is a data structure?
A data structure is a way of organizing and storing data in a computer so that it can be accessed and used efficiently.

2. What is the difference between an array and a linked list?
An array is a data structure that stores a collection of elements in contiguous memory locations, while a linked list stores elements in a series of nodes, each containing the data and a pointer to the next node.

3. What is a stack?
A stack is a data structure that follows the "last in, first out" (LIFO) principle. It allows data to be inserted and removed from only one end, the top.

4. What is a queue?
A queue is a data structure that follows the "first in, first out" (FIFO) principle. It allows data to be inserted at one end, the rear, and removed from the other end, the front.

5. What is a tree?
A tree is a hierarchical data structure that consists of nodes connected by edges. Each node can have zero or more child nodes, and there is a unique node at the top called the root.

6. What is a binary search tree?
A binary search tree is a type of tree where each node has at most two child nodes, and the values of the left child are less than or equal to the parent, while the values of the right child are greater than or equal to the parent.

7. What is a hash table?
A hash table is a data structure that stores key-value pairs, allowing constant-time average case operations for insertion, deletion, and lookup.

8. What is a priority queue?
A priority queue is a data structure that allows elements to be inserted with a priority value, and the element with the highest priority value can be removed first.

9. What is a heap?
A heap is a tree-based data structure that satisfies the heap property, which means that the value of each node is greater than or equal to the values of its children in a max heap, or less than or equal to the values of its children in a min heap.

10. What is a graph?
A graph is a collection of vertices connected by edges, and can be represented using an adjacency matrix or an adjacency list. Graphs can be directed or undirected, and can have weighted or unweighted edges.

No comments

Powered by Blogger.