13 Priority Queues Sorting Flashcards

1
Q

Priority Queue

A

A data structure for maintaing a set of elements, each with an associated value called a key.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A max-priority queue supports the following operations:

A

INSERT - Inserts a new element into the set.

EXTRACT-MAX - removes and returns the element with the largest key.

INCREASE-KEY - increases the value of element key to the new value which is assummed to be at least as largest as currency key value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Priority Queues Operations Running times:

A

O(log n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

MAX-HEAPIFY Running Time

A

O(log n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

BUILD MAX-HEAP Running Time

A

O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

HEAP-SORT

A

O(n log n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Insertion Sort

A

A variation of priority queue sorting where the priority queue is implemented with a sorted array.

O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Selection Sort

A

A variation of priority queue sorting where the priority queue is implemented with a unsorted array.

O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Heapsort

A

A variation of priority queue sorting where the priority queue is implemented with a binary heap.

n insertions takes O(n) time
n removals take O(n log n) time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly