Q. What is the worst-case time complexity for inserting an element into a Red-Black tree?
A.
O(log n)
B.
O(n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The worst-case time complexity for inserting an element into a Red-Black tree is O(log n) due to its balanced structure.
Correct Answer:
A
— O(log n)
Learn More →
Q. What is the worst-case time complexity for insertion in a Red-Black tree?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The worst-case time complexity for insertion in a Red-Black tree is O(log n).
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for insertion in an AVL tree?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The worst-case time complexity for insertion in an AVL tree is O(log n) because the tree remains balanced.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for searching an element in a balanced binary search tree?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The worst-case time complexity for searching an element in a balanced binary search tree is O(log n).
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for searching an element in a binary search tree (BST) using DFS?
A.
O(log V)
B.
O(V)
C.
O(E)
D.
O(V^2)
Show solution
Solution
In the worst case, a BST can degenerate into a linked list, leading to a time complexity of O(V).
Correct Answer:
B
— O(V)
Learn More →
Q. What is the worst-case time complexity for searching an element in a binary search tree?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
In the worst case, a binary search tree can degenerate into a linked list, leading to a search time complexity of O(n).
Correct Answer:
A
— O(n)
Learn More →
Q. What is the worst-case time complexity for searching an element in a linked list?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
In the worst case, you may have to traverse the entire linked list to find an element, resulting in O(n) time complexity.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity for searching an element in a queue?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
In a queue, searching for an element requires traversing the entire queue, leading to a worst-case time complexity of O(n).
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity for searching an element in a Red-Black Tree?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The worst-case time complexity for searching an element in a Red-Black Tree is O(log n) due to its balanced nature.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for searching an element in a sorted array using binary search?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
Binary search has a worst-case time complexity of O(log n) for searching in a sorted array.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for searching an element in an unsorted array?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n log n)
Show solution
Solution
In the worst case, you may need to check every element in the array, leading to O(n) time complexity.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity for searching an element in an unsorted linked list?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
In the worst case, you may have to traverse the entire linked list, leading to O(n) time complexity.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity for searching an element in an unsorted stack?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
The worst-case time complexity for searching an element in an unsorted stack is O(n), as you may need to check each element.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity for searching in a Red-Black tree?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The worst-case time complexity for searching in a Red-Black tree is O(log n) due to its balanced nature.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity of binary search?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
In the worst case, binary search still operates in O(log n) time complexity.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity of bubble sort?
A.
O(n)
B.
O(n log n)
C.
O(n^2)
D.
O(1)
Show solution
Solution
The worst-case time complexity of bubble sort is O(n^2) when the array is sorted in reverse order.
Correct Answer:
C
— O(n^2)
Learn More →
Q. What is the worst-case time complexity of DFS for a graph represented as an adjacency list?
A.
O(V + E)
B.
O(V^2)
C.
O(E)
D.
O(V log V)
Show solution
Solution
The worst-case time complexity of DFS is O(V + E) for an adjacency list representation.
Correct Answer:
A
— O(V + E)
Learn More →
Q. What is the worst-case time complexity of DFS for a graph represented as an adjacency matrix?
A.
O(V)
B.
O(E)
C.
O(V^2)
D.
O(V + E)
Show solution
Solution
In the worst case, DFS will check all entries in the adjacency matrix, leading to a time complexity of O(V^2).
Correct Answer:
C
— O(V^2)
Learn More →
Q. What is the worst-case time complexity of DFS in a graph?
A.
O(V)
B.
O(E)
C.
O(V + E)
D.
O(V * E)
Show solution
Solution
The worst-case time complexity of DFS is O(V + E) as it visits each vertex and edge once.
Correct Answer:
C
— O(V + E)
Learn More →
Q. What is the worst-case time complexity of DFS on a graph?
A.
O(V + E)
B.
O(V^2)
C.
O(E)
D.
O(V)
Show solution
Solution
The worst-case time complexity of DFS is O(V + E), as it visits every vertex and edge in the graph.
Correct Answer:
A
— O(V + E)
Learn More →
Q. What is the worst-case time complexity of DFS?
A.
O(V)
B.
O(E)
C.
O(V + E)
D.
O(V^2)
Show solution
Solution
The worst-case time complexity of DFS is O(V + E), as it visits each vertex and edge once.
Correct Answer:
C
— O(V + E)
Learn More →
Q. What is the worst-case time complexity of Dijkstra's algorithm when using an adjacency matrix?
A.
O(V^2)
B.
O(E log V)
C.
O(V log V)
D.
O(E + V log V)
Show solution
Solution
When using an adjacency matrix, the worst-case time complexity of Dijkstra's algorithm is O(V^2) because each vertex must be checked against all others.
Correct Answer:
A
— O(V^2)
Learn More →
Q. What is the worst-case time complexity of Heap Sort?
A.
O(n log n)
B.
O(n^2)
C.
O(n)
D.
O(log n)
Show solution
Solution
The worst-case time complexity of Heap Sort is O(n log n) because it builds a heap and then sorts it.
Correct Answer:
A
— O(n log n)
Learn More →
Q. What is the worst-case time complexity of inserting an element at the beginning of a singly linked list?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n log n)
Show solution
Solution
Inserting at the beginning of a singly linked list is a constant time operation, O(1).
Correct Answer:
A
— O(1)
Learn More →
Q. What is the worst-case time complexity of inserting an element at the end of a singly linked list?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
Inserting at the end of a singly linked list requires traversing the entire list, resulting in O(n) time complexity.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity of inserting an element in a binary search tree?
A.
O(log n)
B.
O(n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The worst-case time complexity of inserting an element in a binary search tree is O(n), which occurs when the tree becomes unbalanced.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity of inserting an element into a binary search tree?
A.
O(log n)
B.
O(n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The worst-case time complexity of inserting an element into a binary search tree is O(n), which occurs when the tree becomes unbalanced.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity of inserting an element into a linked list?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
Inserting an element in a linked list requires traversing the list in the worst case, leading to O(n).
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity of insertion in a linked list?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
Inserting an element in a linked list can take O(n) time in the worst case if the position is at the end and traversal is required.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity of insertion in a singly linked list?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
In the worst case, you may need to traverse the entire list to find the insertion point, resulting in O(n) time complexity.
Correct Answer:
B
— O(n)
Learn More →
Showing 1981 to 2010 of 3237 (108 Pages)