Worst-Case and Average-Case Analysis · Short answer · 2 marks
Prove from the definition that .
Suppose for all , for some constants . Dividing by gives for all . But violates this, a contradiction.
Balanced and Augmented Search Trees · Short answer · 2 marks
Let be the fewest nodes in an AVL tree of height , with , and .
What is ? [1]
What is the greatest possible height of an AVL tree with exactly 50 nodes? [1]
The sequence is , so .
Height 7 needs at least 54 nodes, which is more than 50, while . The greatest possible height is .
Randomized Algorithms and Quicksort · Problem · 6 marks
A permutation of , with , is chosen uniformly at random. A -cycle is a pair , , with and .
Find the expected number of fixed points of (indices with ). [1]
Find the expected number of -cycles of . [2]
Let be the number of indices with . Show that equals the number of fixed points plus twice the number of -cycles, and find . [3]
(a) , since .
(b) For each unordered pair let . Fixing two values of leaves permutations, so . Summing over the pairs gives .
(c) holds iff , or and , i.e. iff is a fixed point or belongs to a -cycle. Each -cycle contributes two such indices, so and . (Directly: for each .)
Disjoint Sets · Multiple choice · 1 mark
A forest uses union by rank (no path compression). What is the smallest number of nodes that a tree of rank can contain?
Answer: (D)
The rank of a root grows only when two roots of equal rank are joined, so a tree of rank is the union of two trees of rank (plus possibly more nodes attached later). Writing for the minimum size, and , hence . The value would be a path, has no justification, and is off by one level of doubling.
Minimum Spanning Trees and Lower Bounds · Multiple choice · 1 mark
A comparison-based algorithm sorts distinct keys by asking questions of the form “is ?”. What is the largest lower bound that the decision-tree argument gives on its worst-case number of comparisons?
Answer: (C)
The tree must have a leaf for each of the orderings, and a binary tree of height has at most leaves, so and . Using (or ) rounds down, is the cost of finding the maximum, and is the number of pairs, not a bound from the tree.
Data Structures and Analysis · University of Toronto (UofT, U of T, UToronto) · also written CSC263, CSC 263
Make a free, printable CSC263H1 practice exam: choose the topics, the length and the difficulty above, and get an exam-style PDF with a full answer key. Each paper draws on 450 original questions and skips the ones you have already seen.
Start with the past exams and tests your instructor or the UofT library shares: they show what your course actually asks. Most courses only have a few, so once you have worked through them, make fresh CSC263H1 practice exams here on the same topics, with full answer keys, as many as you need. The questions here are original, not copies of past exams.
questionbank.dev is independent and not affiliated with University of Toronto. Course codes only say which topics a paper covers; papers are original practice material, not past or upcoming exams.