
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This assignment was given by Manju Nripendra at West Bengal State University for Theory of Complexity and Algorithms course. It includes: Depth, Big, Swap, Maximum, Internal, Node, Variable, Children
Typology: Exercises
1 / 1
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?)