FlashKeepers

Computer Science · College · College and University

Data Structures, Unit 6: Heaps and Priority Queues

Data Structures, unit: Heaps and Priority Queues. Core concepts, terminology, and worked-example cues a college student meets for this unit, building on prior units without repeating them. Front: a term, concept, or short problem cue. Back: the definition, explanation, or answer.

About this set

38 basic cards for College Computer Science. Set 6 of 10 in Data Structures. It opens with "What is a heap?" and "What is the heap property?". Study it alongside the other College sets below.

38 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What is a heap?
Show answerA complete binary tree satisfying the heap property, commonly used to implement priority queues
What is the heap property?
Show answerEvery parent node is greater than (max-heap) or less than (min-heap) its children
What is a priority queue?
Show answerAn abstract data structure where each element has a priority, and higher-priority elements are served first
What is the time complexity of finding the minimum element in a min-heap?
Show answerO(1), it is always at the root
What is the time complexity of inserting a new element into a heap?
Show answerO(log n)
What is the time complexity of removing the root (min or max) from a heap?
Show answerO(log n)
What operation restores the heap property after insertion, moving a node upward?
Show answerSift-up (bubble-up)
What operation restores the heap property after removal, moving a node downward?
Show answerSift-down (bubble-down, or heapify)
What is heapify?
Show answerThe process of converting an arbitrary array into a valid heap
What is the time complexity of building a heap from an unsorted array (heapify)?
Show answerO(n)
How is a binary heap typically implemented, in terms of memory structure?
Show answerAs an array, using index arithmetic to represent parent-child relationships
In an array-based heap, what is the formula for finding a node's children given its index i?
Show answerLeft child at 2i+1, right child at 2i+2 (zero-indexed)
In an array-based heap, what is the formula for finding a node's parent given its index i?
Show answer(i-1)/2, using integer division
What is heap sort?
Show answerA sorting algorithm that builds a heap and repeatedly extracts the maximum (or minimum) element
What is the time complexity of heap sort?
Show answerO(n log n)

23 more cards in the app

Study this set free