# Ternary Heap Multiple Choice Questions and Answers (MCQs)

This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Ternary Heap

1. What is the ancestor of the leaf node in a given minimum ternary heap?

A) 1
B) 10
C) 18
D) 20

Explanation: The root node of a minimum ternary heap is the smallest unit. In a minimum ternary heap, the parent nodes are all equal to or less than the children nodes. The node on the path from that node to the root node is called an ancestor. As a result, the ancestor of all leaf nodes in this case is 1.

2. Which property should ternary heap hold for execution?
A) Associative
B) Commutative
C) Tree
D) Heap

Explanation: In the field of computer science, a ternary heap is a form of data structure. It’s a member of the Heap family of data structures. As a result, it must possess all of the properties of a heap, which means that all of the heap’s levels must be filled from left to right.

3. Should leaves in ternary heap be distributed from left to right.
A) True
B) False

Explanation: In the field of computer science, a ternary heap is a form of data structure. It’s a member of the Heap family of data structures. As a result, it must possess all of the properties of a heap, which means that all of the heap’s levels must be filled from left to right.

4. What is the process of building a ternary heap called?
A) Heapify
B) Hashing
D) Merging

Explanation: In the field of computer science, a ternary heap is a form of data structure. It’s a member of the Heap family of data structures. Heapify refers to the method of constructing a ternary heap.

5. Which type of data structure is a ternary heap?
A) Array
B) Hash
C) Priority Queue
D) Priority Stack

Explanation: In the field of computer science, a ternary heap is a form of data structure. It’s a member of the Heap family of data structures. It’s a priority queue data structure that adheres to all heap properties.

6. Is the priority queue abstract data type.
A) True
B) False

Explanation: The term “priority queue” refers to an abstract data form. It’s also an extension of the Queue data structure, in which all of the elements are given a priority and then dequeued from the structure based on that priority.

7. What is a ternary heap?
A) An array with three elements
B) Linked list with three elements
C) Tree with three children
D) Heap with all nodes having three children

Explanation: In the field of computer science, a ternary heap is a form of data structure. It’s a member of the Heap family of data structures. As a result, it follows all of the heap’s properties. As a result, any node in the ternary heap has three nodes.

8. Who invented d-ary heap?
A) Carl Rick
B) Alan Turing
C) Donald Johnson
D) Euclid

Explanation: In the field of computer science, a ternary heap is a form of data structure. It’s a member of the Heap family of data structures. Donald Johnson came up with the concept of the d-ary heap in 1975.

9. What is the smallest element of the given minimum ternary heap?

A) 1
B) 10
C) 18
D) 20
Explanation: In the field of computer science, a ternary heap is a form of data structure. It’s a member of the Heap family of data structures. The root node of a minimum ternary heap is the smallest unit. In a minimum ternary heap, the parent nodes are all equal to or less than the children nodes.

10. What is the highest element of the given maximum ternary heap?

A) 31
B) 10
C) 18
D) 20

Explanation: In the field of computer science, a ternary heap is a form of data structure. It’s a member of the Heap family of data structures. The root node of a maximum ternary heap is the highest element. In a maximum ternary heap, the parent nodes are all equal to or greater than the children nodes.

11. What is the child of smallest element of the given minimum ternary heap?

A) 1
B) 10
C) 22
D) 24

Explanation: The root node of a minimum ternary heap is the smallest unit. In a minimum ternary heap, the parent nodes are all equal to or less than the children nodes. The smallest element in the above minimum ternary heap is 1 and its children are 10, 18, and 20.

12. What are the siblings of smallest element of the given maximum ternary heap?

A) 31
B) 12
C) 18
D) 22

Explanation: The root node of a maximum ternary heap is the highest element. In a maximum ternary heap, the parent nodes are all equal to or greater than the children nodes. In the maximum ternary heap, the smallest member is 10 and its siblings are 18, 20.

13. What is the height of a given minimum ternary heap?

A) 1
B) 10
C) 2
D) 24

Explanation: The root node of a minimum ternary heap is the smallest unit. In a minimum ternary heap, the parent nodes are all equal to or less than the children nodes. The total length from the root node to the leaf node is known as height. As a result, the minimum ternary heap’s height is 1.

14. What is the time complexity for increasing priority of key in a minimum ternary heap of n elements?
A) O (log n/ log 3)
B) O (3log n/ log 3)
C) O (n)
D) O (1)

Explanation: It performs downward swapping to increase the priority of a key in a minimum ternary heap data structure with n elements. As a result, the worst-case time complexity is found to be O (3log n/ log 3).

15. What is the time complexity for decreasing priority of key in a maximum ternary heap of n elements?
A) O (log n/ log 3)
B) O (3log n/ log 3)
C) O (n)
D) O (1)

Explanation: It performs downward swapping to lower the priority of the key in a maximum ternary heap data structure with n elements. As a result, the worst-case time complexity is found to be O (3log n/ log 3).

16. Do ternary heap have better memory cache behavior than binary heap.
A) True
B) False

Explanation: In the field of computer science, a ternary heap is a form of data structure. It’s a member of the Heap family of data structures. They have better memory cache behaviour as a result of the swapping operation.

17. What is the time complexity for creating a ternary heap using swapping?
A) O (log n/ log 3)
B) O (n!)
C) O (n)
D) O (1)

Explanation: Two swapping operations can be used to build Ternary Heap. As a result, the time complexity of constructing a ternary heap with two swapping operations is O. (n).

18. Which of the following is the application of minimum ternary heap?
A) Prim’s Algorithm
B) Euclid’s Algorithm
C) Eight Queen Puzzle
D) Tree

Explanation: The Prim’s Algorithm for spanning trees uses a minimum ternary heap when operating on a graph in computer science since there are delete operations equal to the number of edges and decrease priority operations equal to the number of vertices associated with the graph.

19. What is the time complexity for inserting a new item in a ternary heap of n elements?
A) O (log n/ log 3)
B ) O (n!)
C) O (n)
D) O (1)

Explanation: When it comes to inserting a new item into a ternary heap data structure with n items, the heap is extremely efficient. As a result, the worst-case time complexity is found to be O (log n/ log 3).

20. Is decrease priority operation performed more quickly in a ternary heap with respect to the binary heap.
A) True
B) False

Explanation: In the field of computer science, a ternary heap is a form of data structure. It’s a member of the Heap family of data structures. In a ternary heap, the decrease priority operation performs more quickly due to the swapping mechanism.

21. What is the time complexity for decreasing priority of key in a minimum ternary heap of n elements?
A) O (log n/ log 3)
B) O (n!)
C) O (n)
D) O (1)

Explanation: When it comes to decreasing the priority of an object in a ternary heap data structure with n items, the heap is extremely efficient. As a result, the worst-case time complexity is found to be O (log n/ log 3). The upwards swapping mechanism is to blame for this.

22. What is the time complexity for increasing priority of key in a maximum ternary heap of n elements?
A) O (log n/ log 3)
B) O (n!)
C) O (n)
D) O (1)

Explanation: It performs upwards swapping to increase the priority of an object in a ternary heap data structure with n items. As a result, the worst-case time complexity is found to be O (log n/ log 3).

23. What is the time complexity for deleting root key in a ternary heap of n elements?
A) O (log n/ log 3)
B) O (3log n/ log 3)
C) O (n)
D) O (1)

Explanation: It uses downward swapping to delete a root key in a ternary heap data structure with n elements. As a result, the worst-case time complexity is found to be O (3log n/ log 3).

The d-ary heap, also known as the d-heap, is a priority queue data structure that is a generalisation of the binary heap with d children instead of two. A binary heap is a two-heap, while a ternary heap is a three-heap. Donald B. Johnson invented d-ary heaps in 1975, according to Tarjan and Jensen et al. At the cost of slower delete minimum operations, this data structure allows decrease priority operations to be done more rapidly than binary heaps. For algorithms like Dijkstra’s algorithm, where decrease priority operations are more popular than delete min operations, this tradeoff results in faster running times.