NEW
Font size
WorksheetsData Structures and Algorithm
Total questions: 30
Worksheet time: 16mins
Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?
Insertion Sort
Quick Sort
Merge Sort
Heap Sort
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is (GATE CS 2002)
log 2 n
n/2
log 2 n - 1
n
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, membership, cardinality will be the slowest? (GATE CS 2004)
membership, cardinality
intersection, membership
union, intersection
union only
The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is
Θ(n)
Θ(logn)
Θ(log*n)
Θ(1)
A series of values stored in memory is called ___
an array
a tree
a matrix
a struct
In some languages, arrays are also called ___
groups or arrows
roots or leaves
lists or vectors
lines or strings
Arrays of characters, like letters, numbers, punctuation and other written symbols, are called ___
structs
vectors
strings
groups
Finding the location of a given item in a collection of items is called ……
Discovering
Finding
searching
mining
Example of linear data structure except
array
tree
queue
stack
Which of these data structures is LIFO?
Stack
Queue
Binary Tree
Double linked list
Which one of the following is the process of inserting an element in the stack?
Insert
Add
Push
None of the above
Which one of the following is not the application of the stack data structure
string reversal
Recursion
backtracking
Asynchronous data transfer
If the elements '1', '2', '3' and '4' are added in a stack, so what would be the order for the removal?
1234
2134
4321
4231
Which of the following principle does Queue use?
LIFO Principle
FIFO Principle
Linear tree
Ordered tree
Which of the following is the time complexity to search an element in the linked list?
O(1)
O(n)
O(logn)
O(nlogn)
What is the maximum number of children that a node can have in a binary tree?
1
2
3
4
………………. is not an operation performed on linear list
Insertion
Insertion & Deletion
Deletion & Traversal
None of the above
A linear collection of data elements where the linear node is given by means of pointer is called
linked list
primitive list
node list
None of these
………… is very useful in situation when data have to stored and then retrieved in reverse order.
Stack
Queue
List
Linked list
Which of the following is a linear data structure?
Array
AVL Tree
Binary Tree
Graphs
How is the 2nd element in an array accessed based on pointer notation?
*a + 2
*(a+2)
*( * a + 2 )
&(a+2)
How are String represented in memory in C
An array of characters.
the object of some class
same as other primitive data types
Linked List of characters
Which of the following sorting algorithms provide the best time complexity in the worst-case scenario?
merge sort
quick sort
bubble sort
selection sort
Which of the following is a Divide and Conquer algorithm?
merge sort
heap sort
bubble sort
selection sort
What is the time complexity of the binary search algorithm?
O(n)
O(1)
O(log2n)
O(n^2)
Which of the following represents the Postorder Traversal of a Binary Tree ?
Left -> Right -> Root
Left -> Root -> Right
Right -> Left -> Root
Right -> Root -> Left
How many swaps are required to sort the given array using bubble sort - { 2, 5, 1, 3, 4}
4
5
6
7
Minimum number of fields in each node of a doubly linked list is ____
1
2
3
4
The elements of a linked list are stored
In a structure
In an array
Anywhere the computer has space for them
In contiguous memory locations
Bonus question
wrong answer
wrong answer
wrong answer
correct answer
