Algorithm Development Quiz Solution

QUESTION 1

1. Write a function to output an arbitrary double number (which might be negative) using only printDigit for I/O.



QUESTION 2

1. Order the following functions by growth rate:



QUESTION 3

1. Write a code snippet to swap two adjacent elements by adjusting only the links (and not the data) using a singly linked list.



QUESTION 4

1. Using the figure below, answer the following questions.

· Which node is the root?

· Which nodes are the leaves?

· For the whole tree, what is the depth?



QUESTION 5

1. For each node in the tree blow, answer the following questions.

· Name the parent node.

· Name the children.

· List the siblings.

· Compute the depth.

· Compute the height.
Powered by