Data Structures - Heap Quiz Prep

Ace your homework & exams now with Quizwiz!

T

(T/F) The first element of the array is ALWAYS the root node.

pile

A collection of unsorted objects with no particular structure.

The bottom node

After the remove function removes the root node, which node is used to replace it?

smallest or largest element

Can also be used to find the k ___ in an array of numbers.

(node -1)/2

Formula for finding parent of node?

complete

Heaps are considered ___ trees

array

Heaps are generally NOT implemented as a node based tree, but rather as an ___ based tree.

greatest

In a max heap, the root would have the ___ value of all the nodes.

smallest

In a min heap, the root would have the ___ value of all the nodes.

left child = 2i + 1 right child = 2i + 2

In general, the children of some parent in an element at index i is...?

heap build

The ___ function takes a broken heap and restores it.

up

The bubble??? function compares a child to its parent with no regard to the child's sibling.

down

The bubble??? function compares the parent to its children.

8 ( You would use the actual number of elements in the array as the heap size. Not 7, which would be the index that the 8th element resides in, nor 20, which would be the size of the entire array. )

The formula used for heap build is: HeapSize/2 Say you are choosing to represent your heap with an array that has an overall size of 20. However, there are only 8 elements in the array (indices 0 - 7). If you were to use the heap build function on this array, what would HeapSize be equal to in this case?

binary heap property

The heap is a kind of ___ tree that meets the ___ ___.

The parent's value is always greater than the children.

The heap property for the Max Heap:

The parent's value is always less than the children.

The heap property for the Min Heap:

two ( one for min heaps and one for max heaps. )

The heap property has ___ definitions,

it serves as a priority queue.

What is the purpose of the heap?

at the end

Where does insert put new elements in the heap?

remove and buildHeap

Which function(s) call(s) bubbleDown?

insert

Which function(s) call(s) bubbleUp?

the one at the top

Which node does the remove function remove?


Related study sets

Unit 35: Lab Work - Comfort and Psychrometric

View Set

5.3 + 5.4 Third-Party Risk Assessment and Management + effective security Compliance + Audits and assessments

View Set

Chapter 10: Measuring a Nation's Income

View Set

The Firm: Owners, Managers and Employees

View Set