CPI 220 Quizzes

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/43

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

44 Terms

1
New cards

Algorithms can write themselves with machine learning methods.

True

2
New cards

Who is famous for his work on merge sort and with the Manhattan Project?

John von Neumann

3
New cards

Which algorithm is considered to be the oldest?

Euclid’s Greatest Common Divisor

4
New cards

The ________________________________ is a matching problem that has been used to improve kidney donation matches.

Stable Marriage Problem

5
New cards

In Java, real is a primitive type.

False

6
New cards

Java has only two primitive data types.

False

7
New cards

An object is an entity that can take on a data-type value.

True

8
New cards

API is an acronym for 

Application Programming Interface

9
New cards

Objects are characterized by three essential properties: The state of an object is a value from its data type; the identity of an object distinguishes one object from another; the behavior of an object is the effect of data-type operations.

True

10
New cards

As a general principle, we want to avoid compile time errors and rather have run time errors.

False

11
New cards

In implementing a queue with a linked-list

aa --> bb --> ab --> a --> zz--> oo --> ff --> null

the "back of the queue" pointer will be located at

ff

12
New cards

The add and delete operation for a stack are enqueue and pop.

False

13
New cards

A queue cannot be implemented with an array.

False

14
New cards

When an item is removed from a queue, this item is the most recently added item.

False

15
New cards

Floating point multiplication and division take the same amount of time.

False

16
New cards

How many operations are executed in the following code.

for(i=0; i<N; i++)

      for(j=0; j<N; j++)

             a = j;

17
New cards

Many algorithms have an order of growth that falls into one of the following function categories. Which sequence of these functions is in the correct order from slowest to fastest running algorithm?

N^3, N^2, NlogN, N, logN, 1

18
New cards

The power law is used to model run time. For input size N, it is

T(N) = 

aN^b

19
New cards

When modeling the run-time of an algorithm with the power law, T(N) = aN^b, we can use the "doubling hypothesis" method. By repeatedly doubling the input size, we will find an estimate of "a" in T(N). The second step is to estimate "b".

False

20
New cards

The API for dynamic connectivity describes the functions

find, connected, union.

21
New cards

The graph

0 ‐‐‐ 2 ‐‐‐‐ 3 ‐‐‐‐ 5            6‐‐‐‐‐ 7‐‐‐‐‐8‐‐‐‐‐9

has _____ connected components.

2

22
New cards

An equivalence relation has three properties: reflexive, symmetric, and intransitive.

False

23
New cards

The following array is storing _______ connected components

array index = 0 1 2 3 4 5 6 7 8 9
               id = 0 1 9 4 9 6 6 7 8 9

7

24
New cards

Weighted Quick-union uses more memory than Quick-union for the purpose of reducing tree height.

True

25
New cards

In the game "rock, paper, scissors" there is a total order on the tools.

False

26
New cards

The condition that entries to the left of a[i] are fixed and in ascending order is an invariant in selection sort.

True

27
New cards

In sorting algorithms in this section, the compareTo() method, when used as a.compareTo().(b), must return

    -1  when  b < a 
     0  when  a = b
     1  when  a < b

False

28
New cards

Insertion sort is a divide and conquer algorithm.

False

29
New cards

Binary insertion sort sorts 0s and 1s only

False

30
New cards

A stable sort preserves the relative order of items with equal keys.

True

31
New cards

A sorting algorithm sorted the following items first by time and then by city. It a stable sorting algorithm.

Mesa    10:00
Mesa     09:00
Phoenix   9:00
Phoenix  11:00
Scottsdale  12:00

False

32
New cards

Merge sort uses extra space proportional to the input array size.

True

33
New cards

Merge sort in run time complexity is for N items.

False

34
New cards

The basic merge sort algorithm can be improved by using insertion sort on "small" subarrays. 

True

35
New cards

Quick sort runs in optimal time if the array is sorted.

False

36
New cards

Quick sort worst case time complexity is N lg N.

False

37
New cards

Quick sort always partitions at the midpoint of the array.

False

38
New cards

Quick sort can benefit from using insertion sort on small subarrays.

True

39
New cards

Quick sort is a divide and conquer algorithm.

True

40
New cards

Priority queues are a good choice when input data is streaming and at any point in time, some "small" number of items with the largest or smallest values need to be identified.

True

41
New cards

Insertion in a binary heap requires the new node to sink.

False

42
New cards

In a heap ordered binary tree, a parent key is greater than its children's keys.

False

43
New cards

Heap sort uses a stack.

True

44
New cards

In a MaxPQ, the method delete the maximum requires a call to the binary heap sink method.

True