lecture 4 (Unfinished) Flashcards

1
Q

Why Sorting?

A

Sorting is one of the most common tasks in data analysis.

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

What is Selection sort?

A

The Selection Sort algorithm repeatedly finds the smallest element in the unsorted tail region of a list and moves it to the front
Big O -n^2

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

What is a Linear Search?

A

The list is traversed sequentially, and every element is checked#

List does NOT need to be sorted

Big-O: O(n)

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

What is a Binary Search?

A

A ‘divide and conquer algorithm
The list MUST be sorted

Big-O: O(log2(n))

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

How do you conduct a Binary Search?

A

1) find the middle element- if a match then were done

2) if the key is less the middle element the key must be in the first half (opposite if key bigger)

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

Binary Search vs Linear Search

A

Binary search algorithm is much faster, But it only works on sorted data.

Big-O of O(log2(n))

If Binary Search is used with selection sort then Linear Search is faster

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

What is Algorithm Complexity?

A

Algorithmic complexity tells us how slow or fast an algorithm performs

T(n) will be used to denote the time an algorithm takes to execute – time versus input size n

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

How do you perform asymptotic analysis?

A

We find the worst-case number of primitive operations executed as a function of the input size, T(n)
We express this function with Big-Oh notation

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