Question

1. In a heap, the upper bound on the number of leaves is: (A) O(n) (B)...

1. In a heap, the upper bound on the number of leaves is: (A) O(n)
(B) O(1) (C) O(logn) (D) O(nlogn)
2. In a heap, the distance from the root to the furthest leaf is:
(A) θ(nlogn) (B) θ(logn)
(C) θ(1) (D) θ(n)
3. In a heap, let df be the distance of the furthest leaf from the root and let dc be the analogous distance of the closest leaf. What is df − dc, at most?
(A) 1 (C) 2
(B) θ(logn) (D) 0
4. What is the most number of nodes in a heap with a single child?
(A) 0 (D) Θ(logn)
(B) Θ(n) (C) 2
(E) 1
5. What is the fewest number of nodes in a heap with a single child?
(A) 0 (C) one per level (B) 1 (D) 2
6. T or F: There can be two or more nodes in a heap with exactly one child.
7. T or F: A heap can have no nodes with exactly one child.
8. T or F: All heaps are perfect trees.
9. T or F: No heaps are perfect trees.
10. T or F: All heaps are complete trees.
11. T or F: No heaps are complete trees.
12. T or F: A binary tree with one node must be a heap.
13. T or F: A binary tree with two nodes and with the root having the smallest value must be a min-heap.
14. T or F: If a node in a heap is a right child and has two children, then its sibling must also have two children.
15. T or F: If a node in a heap is a right child and has one child, then its sibling must also have one child.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

1)  (A) O(n)
2)  (B) θ(logn)
3)  (B) θ(logn)
4)  (E) 1

As per the guidelines we are only allowed to answer first 4 questions. Please make a new post for remaining questions

Add a comment
Know the answer?
Add Answer to:
1. In a heap, the upper bound on the number of leaves is: (A) O(n) (B)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 6. T or F: There can be two or more nodes in a heap with exactly...

    6. T or F: There can be two or more nodes in a heap with exactly one child. 7. T or F: A heap can have no nodes with exactly one child. 8. T or F: All heaps are perfect trees. 9. T or F: No heaps are perfect trees. 10. T or F: All heaps are complete trees. 11. T or F: No heaps are complete trees. 12. T or F: A binary tree with one node must be...

  • 1. A node that is a descendant of another node is called its a. root b....

    1. A node that is a descendant of another node is called its a. root b. sibling c. parent d. child 2. Any node in a tree that does not have any children is refered to as a a. leaf b. tail c. head d. root 3. A binary search tree is a binary tree with what property? a. An internal node is greater than all of its children b. An internal node is less than all of its children...

  • Problem 8. (Heap Top-k) Prof Dubious has made the following claim, and has provided a proof Claim. Let n and k be posit...

    Problem 8. (Heap Top-k) Prof Dubious has made the following claim, and has provided a proof Claim. Let n and k be positive integers such that 2*-1n. In amax-heap H of n elements, the top 21 elements are in the first k layers of the heap. Proof. Since is a max-heap, each node in H must satisfy the heap property, i.e., if H, is an element of H with at least one child then Hmaxchldren(H)). We know that every subtree...

  • Trees and Heaps 1. Show that the maximum number of nodes in a binary tree of...

    Trees and Heaps 1. Show that the maximum number of nodes in a binary tree of height h is 2h+1 − 1. 2. A full node is a node with two children. Prove that the number of full nodes plus one is equal to the number of leaves in a nonempty binary tree. 3. What is the minimum number of nodes in an AVL tree of height 15? 4. Show the result of inserting 14, 12, 18, 20, 27, 16,...

  • 5. A three-heap with n elements can be stored in an array A, where A[O] contains...

    5. A three-heap with n elements can be stored in an array A, where A[O] contains the root of the tree. a) Draw the three-heap that results from inserting 5, 2, 8, 3, 6, 4, 9, 7, 1 in that order into an initially empty three-heap. You do not need to show the array representation of the heap. You are only required to show the final tree, although if you draw intermediate trees. b) Assuming that elements are placed in...

  • A balanced binary tree is a binary tree structure in which the left and right subtrees of every node differ

    Data structures C++1- A balanced binary tree is a binary tree structure in which the left and right subtrees of every node differ in height by no more than 1 Out of the following choices, which is the minimum set of nodes, if removed, will make the BST balanced?2- Which of the following is true for Red-Black Trees ? Select all choices that apply! Select one or more: a. For each node in the tree, all paths from that node to any leaf nodes contain...

  • Implement downHeap(Node *n) for a min heap implemented as an ordinary binary tree with an integer...

    Implement downHeap(Node *n) for a min heap implemented as an ordinary binary tree with an integer member variable "value" and left and right child pointers. Any node might have only a left child, only a right child, both, or neither. The starter code below defines a class called "Node" that has two child pointers ("left" , "right") and an integer "value" member variable. There is also a constructor Node(int val) that initializes the children to nullptr and the node's value...

  • ///Program needs to write in prolog/// 6. A binary tree is either empty or it is...

    ///Program needs to write in prolog/// 6. A binary tree is either empty or it is composed of a root element and two successors, which are binary trees themselves. In Prolog we represent the empty tree by the atom 'nil' and the non-empty tree by the term t(X,L,R), where X denotes the root node and L and R denote the left and right subtree, respectively. The following Prolog term represents the given binary tree below. T1 = t(a,t(b,t(d,nil,nil),t(e,nil,nil)),t(c,nil,t(f,t(g,nil, nil),nil))) d...

  • 1. Suppose that d ≥ 2 is an integer constant. In a d-ary tree, each node...

    1. Suppose that d ≥ 2 is an integer constant. In a d-ary tree, each node has at most d nonempty subtrees. For example, the trees discussed along with heaps had d = 2. We can represent a nearly complete d-ary tree with n nodes using an array whose indexes range from 0 to n−1. (This is different from Cormen’s arrays, whose indexes range from 1 to n.)       Suppose that i is the index of a node in the...

  • Complete HeapPriorityQueue (7 points). In lecture we implemented HeapPriorityQueue using an array-based representation of a heap...

    Complete HeapPriorityQueue (7 points). In lecture we implemented HeapPriorityQueue using an array-based representation of a heap (a complete binary tree whose entries satisfy the heap-order property). For this problem, complete the included HeapPriorityQueue class by using the LinkedBinaryTree class to represent a heap. Hint: the most challenging part of this problem is identifying the last Position in the heap and the next available Position in the heap. It is suggested that you review the array-based heap to better understand how...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT