View the step-by-step solution to:

Data Structures and Introduction to Algorithms in Java Fifth edition Michael T Goodrich . Tamassia 1. (Problem R-10.4, page 499 of the text) How many...

Answer these data structure problems?
Data Structures and Introduction to Algorithms in Java Fifth edition Michael T Goodrich . Tamassia 1. (Problem R-10.4, page 499 of the text) How many different binary search trees can store the keys {1, 2, 3}? 2. Give a linear-time algorithm for testing whether the integer keys stored at the internal nodes of a given binary tree satisfy the binary search tree order property. 3. (Problem C-10.24, page 503 of the text) Describe a sequence of accesses to an n -node splay tree T , where n is odd, that results in T consisting of a single chain of internal nodes with external node children, such that the internal-node path down T alternates between left children and right children. 4. A heap containing keys 1, 2, …, 15 is stored in an array-list A using the standard array-list representation of a complete binary tree, i.e., A [1] stores the root node, and, for every k, the two children (if any) of the node stored in A [k] are stored in A [2k] and A [2k+1]. 1 Where in A can key 15 be stored? 2 Which keys can be stored in A [2]? 3 Where in A can the key 10 be stored? 4 5. (Problem R-8.16, page 379 of the text) Let H be a heap storing 15 entries using an array-list representation of a complete binary tree. What is the sequence of indices of the array list that are visited in a preorder traversal of H ? What about an inorder traversal of H? What about a postorder traversal of H ? 5. Let A and B be two sets of integer keys stored at the internal nodes of two AVL trees, T A and T B , respectively. Suppose that all keys are distinct. We say that A separates B if there is a triplet of keys x < y < z , such that x and z are in B and y is in A . Design an algorithm that takes as input T A and T B and determines whether or not A separates B . Describe the algorithm in English or pseudo-code, including any additional data structures. For full credit the algorithm must have worst-case time complexity of O(log n ), where n denotes the total number of keys in A and B .
Background image of page 1

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question