
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

A Question of Some Depth
Let T be a k-ary tree, i.e. each internal node of T has at most k children. Suppose that the depth of T is d (the maximum depth of any node of T is d). What is the maximum number of external nodes (leaves) that T can have? What is the maximum total number of nodes that T can have?
The Big Swap
Suppose that x and y are two integer variables. How can I swap the values of x and y without using a third temporary variable? (The usual way to do this swap is to do something like
temp โ x x โ y y โ temp.
Here we want to avoid using this extra variable. What can we do instead to achieve this swap?)