Computer Knowledge
Data Structures and Algorithms
1,256 Questions
Data Structures and Algorithms form the core of computer science, focusing on arrays, linked lists, trees, and sorting mechanisms. These concepts are essential for solving complex computational problems efficiently. Test takers preparing for technical and administrative IT exams will find these questions highly relevant.
Array OperationsLinked List ApplicationsSorting AlgorithmsTree Data StructuresMultilevel IndexingAlgorithm Time Complexity
Data Structures and Algorithms Questions
-
link/cut tree
-
AVL tree
-
T-tree
-
splay tree
-
finger tree
D
Correct answer
Explanation
A splay tree is a self-adjusting binary search tree with the additional property that recently accessed elements are quick to access again. It performs basic operations such as insertion, look-up and removal in O(log n) amortized time.
-
A red–black tree is used to organize pieces of comparable data.
-
All leaves (NIL) are black.
-
Pre-order traversal of a red-black tree gives data in sorted order.
-
Every red node must have two black child nodes.
-
Red–black trees are particularly valuable in functional programming.
C
Correct answer
Explanation
Red–black trees, like all binary search trees, allow efficient in-order traversal (that is: in the order Left–Root–Right) of their elements. The search-time results from the traversal from root to leaf, and therefore a balanced tree of n nodes, having the least possible tree height, results in O(log n) search time.
-
Stack
-
Queue
-
Linked list
-
Tree
-
Array
D
Correct answer
Explanation
Tree is recognised as a non-linear data structure as data is stored in it in random order.
-
The array list must be short in size.
-
The array list must be arranged in descending order.
-
The array list must be arranged in increasing order.
-
The array list must have numbers in random order.
-
The array list must be very lengthy.
C
Correct answer
Explanation
This is the most essential condition required for performing binary search as correct values of pointers; Low, Mid and High can only be provided when the list is in increasing order.
-
Searching
-
Sorting
-
Traversing
-
Merging
-
Insertion
C
Correct answer
Explanation
Traversing is the process of accessing each element of the array exactly once to do some operation.
-
Arrays are small in size.
-
Arrays are very big in size.
-
Arrays are static structures.
-
Arrays are dynamic structures.
-
Arrays are easier to implement.
C
Correct answer
Explanation
This is the greatest disadvantage as once the size of the arrays is specified it remains fixed until the user changes it.
B
Correct answer
Explanation
This is the operation in which a new data or element is inserted into the stacks.
-
Delete
-
Malloc
-
Calloc
-
Delete []
-
New
E
Correct answer
Explanation
This operator is used in C++ to dynamically allocate memory space for a new node in the linked list.
-
Front
-
Rear
-
Top
-
Exit
-
Break
B
Correct answer
Explanation
This pointer is incremented in a queue when a new element is added.
-
Traversing
-
Underflow
-
Garbage collection
-
Start
-
Null
C
Correct answer
Explanation
This is the technique in which if a node is deleted from the linked list then the memory space of the deleted node is immediately reinserted into the free storage.
-
Array
-
Pointer
-
Structure
-
Function
-
Union
C
Correct answer
Explanation
This datatype is used in C++ to implement linked list in a program.
-
Traversing a linked list
-
Inserting an item into a linked list
-
Creating a linked list
-
Deleting an item from the linked list
-
Searching an item in a linked list
C
Correct answer
Explanation
This is the first operation performed on a linked list.
-
Complete binary tree
-
Skewed binary tree
-
Full binary tree
-
Forest
-
Height
A
Correct answer
Explanation
In this tree, every level, except possibly the last, is completely filled.
-
Doubly linked list
-
Singly linked list
-
Circular linked list
-
Queues
-
Stacks
C
Correct answer
Explanation
The last node is replaced with the address of the first node.
-
Sorting
-
Searching
-
Traversing
-
Insertion
-
Deletion
C
Correct answer
Explanation
Processing of each node of linked list exactly once is also called traversing.