NEW
Font size
WorksheetsCCDSALG Practice Questions
Total questions: 15
Worksheet time: 8mins
Given: sum = 0 for i = 0 to n: for j = 0 to i: sum += j What is the time complexity?
O(n)
O(n log n)
O(n²)
O(n³)
Let f(n) = 4n² + 6n + 1, g(n) = n². Which is true?
f(n) = O(g(n))
f(n) = Ω(g(n))
f(n) = Θ(g(n))
All of the above
Which function has the slowest growth rate?
log²n
√n
n log n
n²
Let f(n) = 10n + 50, and g(n) = n. Which constants satisfy f(n) ≤ cg(n)?
c = 60, n₀ = 1
c = 10, n₀ = 5
c = 12, n₀ = 10
c = 5, n₀ = 20
Convert (3 + 6) * (4 - 2) into prefix:
* + 3 6 - 4 2
+ 3 6 * - 4 2
+ * 3 6 4 2
* 3 6 - 4 2
Quadratic probing, collision at index 2.
What is the probing sequence?
3, 6, 11
3, 7, 2
3, 4, 5
3, 5, 8
Data structure for infix to postfix conversion?
Queue
Stack
Tree
Graph
Binary tree with height 3, full binary tree. Leaf nodes?
2
4
6
8
Which is FALSE about trees?
A tree is a connected acyclic graph.
A tree with n nodes has n edges
A full binary tree has every node with 0 or 2 children.
The number of leaves in a perfect binary tree is 2^h, where h is the height.
Hash table with h(k) = k mod 11. Keys 1, 2, 3 are taken. Where does 45 go?
1
2
4
5
In this Undirected Graph
P---Q
| |
T--- S
\ /
R
What is true?
Tree
Has a cycle
Disconnected
Forest
Which is FALSE in directed graphs?
In-degree is incoming edges
Sum of in-degrees = total edges
Sum of out-degrees = number of nodes
Zero in-degree node can be topological start
Insert into BST: 50, 30, 70, 20, 40, 60, 80. Inorder traversal?
20, 30, 40, 50, 60, 70, 80
50, 30, 20, 40, 70, 60, 80
20, 40, 30, 60, 50, 70, 80
80, 70, 60, 50, 40, 30, 20
BST with 5 descending values. What it its Height?
2
3
4
5
Which data structure is most appropriate to store ticket requests in FCFS order?
Stack
Queue
Graph
Hash Table
