Cs 101 Flashcards

1
Q

How many steps does it take to delete an item from a binary search tree (BST)? When in (Words)?

A

O(n)

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

How many steps does it take to build a heap using the bottom up method?

A

O(n)

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

How many steps does it take to perform an extract min from a min ordered heap?

A

O(log n)

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

How many steps does it take to perform (-) operation on a que implemented as a linked list?

A

O(1)

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

The worst case to insert (-) Hash table takes how many steps?

A

O(n)

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

The goal of hashing is for (-) to take how many steps on average?

A

O(1)

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

Heap sort using a heap to sort n elements takes how many steps?

A

(n log n)

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

Which operation do hash tables NOT support:

A

Sorting

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

Which operation do heaps NOT support efficiently?

A

Search

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

After an exception is thrown and a catch block execute, execution resumes after the thrown statement.

A

False

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

For a function that may contain a throw, the function’s statements must be surrounded by a try block.

A

False

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

A key advantage of a class template is relieving the programmer from having to write redundant code that differs only by type.

A

True

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

A good hashing function should:

A

Spread the input values over the range of integer outputs.

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

Huffman Codes will provide the most benefit when:

A

There is a skewed distribution of the characters

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