Q. What is the space complexity of DFS using recursion?
A.
O(V)
B.
O(E)
C.
O(V + E)
D.
O(1)
Show solution
Solution
The space complexity of DFS using recursion is O(V) due to the call stack that can go as deep as the number of vertices in the worst case.
Correct Answer:
A
— O(V)
Learn More →
Q. What is the space complexity of Dijkstra's algorithm using an adjacency list?
A.
O(V)
B.
O(E)
C.
O(V + E)
D.
O(V^2)
Show solution
Solution
The space complexity of Dijkstra's algorithm using an adjacency list is O(V + E), where V is the number of vertices and E is the number of edges.
Correct Answer:
C
— O(V + E)
Learn More →
Q. What is the space complexity of Dijkstra's algorithm when using a priority queue?
A.
O(V)
B.
O(E)
C.
O(V + E)
D.
O(V log V)
Show solution
Solution
The space complexity of Dijkstra's algorithm when using a priority queue is O(V), as it needs to store the distance for each vertex.
Correct Answer:
A
— O(V)
Learn More →
Q. What is the space complexity of Dijkstra's algorithm when using an adjacency list representation of the graph?
A.
O(V)
B.
O(E)
C.
O(V + E)
D.
O(V^2)
Show solution
Solution
The space complexity of Dijkstra's algorithm using an adjacency list is O(V + E), where V is the number of vertices and E is the number of edges.
Correct Answer:
C
— O(V + E)
Learn More →
Q. What is the space complexity of Dijkstra's algorithm when using an adjacency list?
A.
O(V)
B.
O(E)
C.
O(V + E)
D.
O(V^2)
Show solution
Solution
The space complexity of Dijkstra's algorithm using an adjacency list is O(V + E), where V is the number of vertices and E is the number of edges.
Correct Answer:
C
— O(V + E)
Learn More →
Q. What is the space complexity of Heap Sort?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n log n)
Show solution
Solution
Heap Sort has a space complexity of O(1) as it sorts the array in place.
Correct Answer:
A
— O(1)
Learn More →
Q. What is the space complexity of Merge Sort?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n log n)
Show solution
Solution
The space complexity of Merge Sort is O(n) because it requires additional space for the temporary arrays used during merging.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the space complexity of Quick Sort in the average case?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n log n)
Show solution
Solution
The average space complexity of Quick Sort is O(log n) due to the recursive stack space used during the sorting process.
Correct Answer:
C
— O(log n)
Learn More →
Q. What is the space complexity of Quick Sort in the worst case?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n log n)
Show solution
Solution
The space complexity of Quick Sort in the worst case is O(log n) due to the recursive stack space.
Correct Answer:
C
— O(log n)
Learn More →
Q. What is the space complexity of recursive tree traversals?
A.
O(n)
B.
O(log n)
C.
O(1)
D.
O(n log n)
Show solution
Solution
The space complexity of recursive tree traversals is O(h), where h is the height of the tree. In the worst case of a skewed tree, this can be O(n), but for balanced trees, it is O(log n).
Correct Answer:
B
— O(log n)
Learn More →
Q. What is the space complexity of storing a linked list with n nodes?
A.
O(1)
B.
O(n)
C.
O(n^2)
D.
O(log n)
Show solution
Solution
A linked list with n nodes requires O(n) space, as each node stores data and a pointer to the next node.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the space complexity of the binary search algorithm?
A.
O(n)
B.
O(log n)
C.
O(1)
D.
O(n log n)
Show solution
Solution
Binary search has a space complexity of O(1) when implemented iteratively, as it uses a constant amount of space.
Correct Answer:
C
— O(1)
Learn More →
Q. What is the space complexity of the dynamic programming solution for the 0/1 Knapsack problem?
A.
O(1)
B.
O(n)
C.
O(w)
D.
O(n*w)
Show solution
Solution
The space complexity of the dynamic programming solution for the 0/1 Knapsack problem is O(n*w), where n is the number of items and w is the maximum weight capacity.
Correct Answer:
D
— O(n*w)
Learn More →
Q. What is the space complexity of the dynamic programming solution for the 0/1 Knapsack problem using a 2D array?
A.
O(n)
B.
O(w)
C.
O(n * w)
D.
O(1)
Show solution
Solution
The space complexity of the dynamic programming solution for the 0/1 Knapsack problem using a 2D array is O(n * w), where n is the number of items and w is the maximum weight.
Correct Answer:
C
— O(n * w)
Learn More →
Q. What is the space complexity of the dynamic programming solution for the edit distance problem?
A.
O(n)
B.
O(m)
C.
O(n * m)
D.
O(1)
Show solution
Solution
The space complexity of the dynamic programming solution for the edit distance problem is O(n * m), where n and m are the lengths of the two strings.
Correct Answer:
C
— O(n * m)
Learn More →
Q. What is the space complexity of the dynamic programming solution for the Fibonacci sequence using memoization?
A.
O(1)
B.
O(n)
C.
O(n^2)
D.
O(log n)
Show solution
Solution
The space complexity of the dynamic programming solution for the Fibonacci sequence using memoization is O(n) due to the storage of computed values.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the space complexity of the dynamic programming solution for the Fibonacci sequence?
A.
O(1)
B.
O(n)
C.
O(n^2)
D.
O(log n)
Show solution
Solution
The space complexity of the dynamic programming solution for the Fibonacci sequence can be optimized to O(1) by storing only the last two computed values.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the space complexity of the dynamic programming solution for the Longest Increasing Subsequence problem?
A.
O(n)
B.
O(n^2)
C.
O(log n)
D.
O(1)
Show solution
Solution
The space complexity of the dynamic programming solution for the Longest Increasing Subsequence problem is O(n) due to the storage of intermediate results.
Correct Answer:
B
— O(n^2)
Learn More →
Q. What is the space complexity of the dynamic programming solution for the Longest Common Subsequence problem?
A.
O(m + n)
B.
O(m * n)
C.
O(m)
D.
O(n)
Show solution
Solution
The space complexity of the dynamic programming solution for the Longest Common Subsequence problem is O(m * n), where m and n are the lengths of the two sequences.
Correct Answer:
B
— O(m * n)
Learn More →
Q. What is the space complexity of the iterative binary search algorithm?
A.
O(n)
B.
O(log n)
C.
O(1)
D.
O(n log n)
Show solution
Solution
The space complexity of the iterative binary search is O(1) since it uses a constant amount of space.
Correct Answer:
C
— O(1)
Learn More →
Q. What is the space complexity of the iterative implementation of binary search?
A.
O(n)
B.
O(log n)
C.
O(1)
D.
O(n log n)
Show solution
Solution
The iterative implementation of binary search uses a constant amount of space, leading to a space complexity of O(1).
Correct Answer:
C
— O(1)
Learn More →
Q. What is the space complexity of the iterative version of binary search?
A.
O(n)
B.
O(log n)
C.
O(1)
D.
O(n log n)
Show solution
Solution
The iterative version of binary search uses a constant amount of space, leading to a space complexity of O(1).
Correct Answer:
C
— O(1)
Learn More →
Q. What is the space complexity of the recursive implementation of inorder traversal?
A.
O(1)
B.
O(n)
C.
O(log n)
D.
O(n log n)
Show solution
Solution
The space complexity of the recursive implementation of inorder traversal is O(n) due to the call stack used for recursion.
Correct Answer:
B
— O(n)
Learn More →
Q. What is the subnet mask for a Class C IP address with 30 usable hosts?
A.
255.255.255.252
B.
255.255.255.240
C.
255.255.255.248
D.
255.255.255.254
Show solution
Solution
A Class C address with 30 usable hosts requires a subnet mask of 255.255.255.252, which allows for 4 IP addresses (2 usable).
Correct Answer:
A
— 255.255.255.252
Learn More →
Q. What is the subnet mask for a network that needs to support 500 hosts?
A.
255.255.255.0
B.
255.255.254.0
C.
255.255.255.128
D.
255.255.255.192
Show solution
Solution
To support 500 hosts, a subnet mask of 255.255.254.0 (/23) is required, providing 510 usable addresses.
Correct Answer:
B
— 255.255.254.0
Learn More →
Q. What is the subnet mask for a network that requires 30 usable IP addresses?
A.
255.255.255.224
B.
255.255.255.240
C.
255.255.255.192
D.
255.255.255.248
Show solution
Solution
To accommodate 30 usable addresses, a /27 subnet mask (255.255.255.224) is needed, providing 32 total addresses (30 usable).
Correct Answer:
A
— 255.255.255.224
Learn More →
Q. What is the subnet mask for a network that requires at least 500 usable IP addresses?
A.
255.255.255.0
B.
255.255.254.0
C.
255.255.255.128
D.
255.255.255.192
Show solution
Solution
To accommodate at least 500 usable addresses, a subnet must have at least 512 total addresses, which corresponds to a /23 subnet mask (255.255.254.0).
Correct Answer:
B
— 255.255.254.0
Learn More →
Q. What is the subnet mask for a network with 30 usable IP addresses?
A.
255.255.255.252
B.
255.255.255.248
C.
255.255.255.240
D.
255.255.255.224
Show solution
Solution
A subnet mask of 255.255.255.252 allows for 2 usable IP addresses (4 total - 2 for network and broadcast), which is suitable for point-to-point links.
Correct Answer:
A
— 255.255.255.252
Learn More →
Q. What is the subnet mask for the IP address 172.16.5.10 if it is part of a /20 network?
A.
255.255.240.0
B.
255.255.255.0
C.
255.255.0.0
D.
255.255.255.240
Show solution
Solution
A /20 subnet mask corresponds to 255.255.240.0, allowing for 4096 addresses in the subnet.
Correct Answer:
A
— 255.255.240.0
Learn More →
Q. What is the time complexity for deleting a node in a Red-Black tree?
A.
O(n)
B.
O(log n)
C.
O(n log n)
D.
O(1)
Show solution
Solution
The time complexity for deleting a node in a Red-Black tree is O(log n) due to its balanced structure.
Correct Answer:
B
— O(log n)
Learn More →
Showing 1741 to 1770 of 3237 (108 Pages)