CSC1310 Exam 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which algorithm is example of Linear Time Big-O Notation?

Linear Search

Which algorithm is the fastest in practice for most arrays/vectors/linked-lists?

Merge Sort

Binary Search Best Runtime

O(1)

Binary Search Space Complexity

O(1)

Bubble Sort Space Complexity

O(1)

Insertion Sort Space Complexity

O(1)

Linear Search Best Runtime

O(1)

Linear Search Space Complexity

O(1)

Selection Sort Space Complexity

O(1)

284 + 8N + 2N^2

O(N^2)

8N^2 + 2N^3

O(N^3)

Binary Search Average Runtime

O(log n)

Binary Search Worst Runtime

O(log n)

Quick Sort Space Complexity

O(log n)

Merge Sort Average Runtime

O(n log n)

Merge Sort Best Runtime

O(n log n)

Merge Sort Worst Runtime

O(n log n)

Quick Sort Average Runtime

O(n log n)

Quick Sort Best Runtime

O(n log n)

Bubble Sort Best Runtime

O(n)

Insertion Sort Best Runtime

O(n)

Linear Search Average Runtime

O(n)

Linear Search Worst Runtime

O(n)

Merge Sort Space Complexity

O(n)

Bubble Sort Average Runtime

O(n^2)

Bubble Sort Worst Runtime

O(n^2)

Insertion Sort Average Runtime

O(n^2)

Insertion Sort Worst Runtime

O(n^2)

Quick Sort Worst Runtime

O(n^2)

Selection Sort Average Runtime

O(n^2)

Selection Sort Best Runtime

O(n^2)

Selection Sort Worst Runtime

O(n^2)

On average, with an array of 20,000 elements, how many comparisons will the linear search perform?

10,000

With an array of 20,000 elements, what is the maximum number of comparisons the binary search will perform?

15

What is the largest number of comparisons that would be required to search a 36,876 array with a binary search?

16

How many average comparisons would be required to search a 36,876 array with a linear search?

18,438

Which search algorithm is more efficient?

Binary

True or False. The bubble sort is an easy way to arrange data in ascending order but it cannot arrange data in descending order.

False

True or False. The linear search function requires the list to be sorted in order from least to greatest.

False

Which list is stored in descending order?

G, B, A

Which algorithm uses the least amount of space in memory to run?

Insertion sort

True or False. If you are using the bubble sort algorithm to sort an array in descending order, the smaller values move toward the end.

True

True or False. Using recursive functions for math problems is common.

True

A recursive function is designed to terminate when it reaches its

base case

The number of times a recursive function calls itself

depth

This type of algorithm is one that finds a best combination of items by looking at ALL the possible combinations

exhaustive

A recursive function is a function that calls

itself

A linear search algorithm is also called a ____ algorithm

sequential


Ensembles d'études connexes

Mortgages 3: Remedies (Disputes as to Sale)

View Set

Ch15: The Autonomic Nervous System

View Set

Atheism: the basis of Atheism and Agnosticism

View Set