Quiz on trees:
- Given two binary search trees, check whether or not they are identical. Identical meaning that both the structures (node location, height, etc.) and the values contained at corresponding nodes are matching.
- Given a value k, and a binary tree T, print out all values at k distance from the root.
- Given a binary search tree T and an integer k, find the node in T with the closest value to k. E.g. if the binary tree contained 20, 23, 30, 34, 40, 51, 54, 60, 70, and k = 31, then the solution should return the node containing 30. (We will deal with integers in this case, so no generics.)
No comments:
Post a Comment