Q. What is the time complexity of the quicksort algorithm in the worst case?
A.
O(n)
B.
O(n log n)
C.
O(n^2)
D.
O(log n)
Show solution
Solution
In the worst case, quicksort can degrade to O(n^2) time complexity, typically when the pivot is the smallest or largest element.
Correct Answer:
C
— O(n^2)
Learn More →
Q. What is the time complexity of the worst-case scenario for Quick Sort when the pivot is the smallest or largest element?
A.
O(n)
B.
O(n log n)
C.
O(n^2)
D.
O(log n)
Show solution
Solution
The worst-case time complexity for Quick Sort occurs when the pivot is the smallest or largest element, resulting in O(n^2).
Correct Answer:
C
— O(n^2)
Learn More →
Q. What is the time complexity of traversing a binary tree using in-order traversal?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
In-order traversal visits each node exactly once, resulting in a time complexity of O(n), where n is the number of nodes in the tree.
Correct Answer:
A
— O(n)
Learn More →
Q. What is the time complexity of traversing a binary tree with n nodes?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
Traversing a binary tree requires visiting each node once, leading to a time complexity of O(n).
Correct Answer:
A
— O(n)
Learn More →
Q. What is the time complexity of traversing a binary tree?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
Traversing a binary tree requires visiting each node once, leading to a time complexity of O(n).
Correct Answer:
A
— O(n)
Learn More →
Q. What is the time complexity of traversing a linked list with 'n' nodes?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
Traversing a linked list requires visiting each node, leading to a time complexity of O(n).
Correct Answer:
B
— O(n)
Learn More →
Q. What is the total number of hosts in a subnet with a /18 subnet mask?
A.
16382
B.
16384
C.
8190
D.
8192
Show solution
Solution
A /18 subnet mask allows for 2^(32-18) = 16384 total addresses, of which 16382 are usable for hosts.
Correct Answer:
B
— 16384
Learn More →
Q. What is the typical output of the intermediate code generation phase?
A.
Source code
B.
Assembly code
C.
Intermediate representation
D.
Executable code
Show solution
Solution
The output of the intermediate code generation phase is typically an intermediate representation that can be further optimized and translated into machine code.
Correct Answer:
C
— Intermediate representation
Learn More →
Q. What is the worst-case number of comparisons in binary search for an array of size 16?
Show solution
Solution
The worst-case number of comparisons is log2(16) = 4, but since we start counting from 0, it takes 5 comparisons.
Correct Answer:
C
— 6
Learn More →
Q. What is the worst-case scenario for binary search?
A.
Finding the first element
B.
Finding the last element
C.
Finding an element not in the array
D.
Finding the middle element
Show solution
Solution
In the worst case, binary search will check all levels of the tree, which is O(log n), but it will not find the element.
Correct Answer:
C
— Finding an element not in the array
Learn More →
Q. What is the worst-case scenario for the number of comparisons in binary search on an array of size n?
A.
n
B.
log n
C.
n log n
D.
1
Show solution
Solution
In the worst case, binary search makes log n comparisons to find the target or determine its absence.
Correct Answer:
B
— log n
Learn More →
Q. What is the worst-case scenario for the number of comparisons in binary search?
A.
n
B.
log n
C.
n log n
D.
1
Show solution
Solution
In the worst case, binary search will make log n comparisons, where n is the number of elements in the array.
Correct Answer:
B
— log n
Learn More →
Q. What is the worst-case scenario for the number of comparisons made by binary search?
A.
n
B.
log n
C.
n log n
D.
1
Show solution
Solution
In the worst case, binary search makes log n comparisons, where n is the number of elements in the array.
Correct Answer:
B
— log n
Learn More →
Q. What is the worst-case scenario for the number of comparisons made by binary search on an array of size n?
A.
n
B.
log n
C.
n log n
D.
1
Show solution
Solution
In the worst case, binary search makes log n comparisons, where n is the number of elements in the array.
Correct Answer:
B
— log n
Learn More →
Q. What is the worst-case scenario for the number of iterations in binary search?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The worst-case scenario for binary search is O(log n), as it halves the search space with each iteration.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for accessing an element in a queue implemented using a linked list?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
Accessing an element in a queue implemented using a linked list has a worst-case time complexity of O(n) because you may need to traverse the list.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity for balancing an AVL tree after insertion?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The worst-case time complexity for balancing an AVL tree after insertion is O(log n).
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for bubble sort?
A.
O(n)
B.
O(n log n)
C.
O(n^2)
D.
O(log n)
Show solution
Solution
The worst-case time complexity for bubble sort occurs when the array is sorted in reverse order, resulting in O(n^2).
Correct Answer:
C
— O(n^2)
Learn More →
Q. What is the worst-case time complexity for deleting a node from 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 deleting a node from a Red-Black tree is O(log n) due to its balanced structure.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for deleting a node from 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 deleting a node from an AVL tree is O(log n) due to the need to maintain balance.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for deleting a node in an AVL tree?
A.
O(1)
B.
O(log n)
C.
O(n)
D.
O(n log n)
Show solution
Solution
The worst-case time complexity for deleting a node in an AVL tree is O(log n) due to the need to maintain balance.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for deleting an element from an AVL tree?
A.
O(1)
B.
O(log n)
C.
O(n)
D.
O(n log n)
Show solution
Solution
The worst-case time complexity for deleting an element from an AVL tree is O(log n) due to the need to maintain balance.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for deletion 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 deletion in an AVL tree is O(log n) due to the tree's balanced structure.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for enqueue and dequeue operations in a queue implemented using a linked list?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n^2)
Show solution
Solution
Both enqueue and dequeue operations can be performed in constant time, O(1), when using a linked list.
Correct Answer:
A
— O(1)
Learn More →
Q. What is the worst-case time complexity for inserting a node 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, if the tree is unbalanced (like a linked list), the time complexity for insertion can be O(n).
Correct Answer:
A
— O(n)
Learn More →
Q. What is the worst-case time complexity for inserting a node 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 inserting a node in an AVL tree is O(log n) due to the tree's balanced nature.
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the worst-case time complexity for 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 for 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 for inserting an element in a binary search tree is O(n), which occurs when the tree is unbalanced.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity for inserting an element in an unbalanced binary 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 in an unbalanced binary tree is O(n), when the tree becomes a linear chain.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the worst-case time complexity for inserting an element into a binary search tree?
A.
O(1)
B.
O(log n)
C.
O(n)
D.
O(n log n)
Show solution
Solution
In the worst case, a binary search tree can become unbalanced (like a linked list), leading to a time complexity of O(n) for insertion.
Correct Answer:
C
— O(n)
Learn More →
Showing 1951 to 1980 of 3237 (108 Pages)