Week 2 Flashcards

1
Q

What is an Algorithm?

A

An algorithm is a sequence of steps for accomplishing a task

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

What is a Linear Search?

A

Linear search is a search algorithm that starts from the beginning of a list, and checks each element until the search key is found or the end of the list is reached.

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

What is an algorithm runtime?

A

An algorithm’s runtime is the time the algorithm takes to execute. If each comparison takes 1 µs (1 microsecond), a linear search algorithm’s runtime is up to 1 s to search a list with 1,000,000 elements, 10 s for 10,000,000 elements, and so on. Ex: Searching Amazon’s online store, which has more than 200 million items, could require more than 3 minutes.

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

What is a Binary Search Algorithm?

A

Binary search is a faster algorithm for searching a list if the list’s elements are sorted and directly accessible (such as an array). Binary search first checks the middle element of the list. If the search key is found, the algorithm returns the matching location. If the search key is not found, the algorithm repeats the search on the remaining left sublist (if the search key was less than the middle element) or the remaining right sublist (if the search key was greater than the middle element).

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

What is Big O notation?

A

Big O notation is a mathematical way of describing how a function (running time of an algorithm) generally behaves in relation to the input size. In Big O notation, all functions that have the same growth rate (as determined by the highest order term of the function) are characterized using the same Big O notation.

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

What are the two rules for the Big O notation?

A
  1. If f(x) is a sum of several terms, the highest order term (the one with the fastest growth rate) is kept and others are discarded.
  2. If f(x) has a term that is a product of several factors, all constants (those that are not in terms of x) are omitted.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the Worst Case Run Time of an Algorithm?

A

the runtime complexity for an input that results in the longest execution.

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

What is Run Time Analysis?

A

Determines the total number of operations. Operations include assignment, addition, comparison, etc.

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

What is Sorting?

A

the process of converting a list of elements into ascending (or descending) order

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

What is a Selection Sort?

A

sorting algorithm that treats the input as two parts, a sorted part and an unsorted part, and repeatedly selects the proper next value to move from the unsorted part to the end of the sorted part.

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