Algorithms Flashcards

1
Q

What is an algorithm?

A

A set of ordered steps for solving problems

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

Where did algorithm come from?

A

The 9th century Persian mathematician, Al Khwarizimi

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

For Psuedo language (PL) how do you check elements in a list for a specific number?

A

Start at the first position and notate it by coming down the list

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

How do you insert a number into a specific position in a list?

A

Move the position number into another position and then insert the desired number into that position

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

What is the BOGO sort?

A

If the list is ordered then its true, if the list is not ordered then randomly shuffle

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

What is the BOZO sort?

A

If the list is ordered then its true, if the list is not ordered then randomly swap two elements

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

What standard sorting lists must you know?

A
  1. bubble sort
  2. Selection sort
  3. Insertion sort
  4. Quick sort
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How does the selection sort work?

A
  1. Find the smallest element and swap it with the first element
  2. Find the next smallest element and swap it with the second element
  3. continue with this
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the insertion sort?

A

Pick an element and insert it into the correct position, move all others to the right

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

What is the quick sort?

A
  1. Choose a single element to be the pivot
  2. Make two sub lists, one being all the elements lower than the pivot and the other being higher
  3. Repeat the above steps until the lists are of 1 length value
  4. Then combine all the lists together
How well did you know this?
1
Not at all
2
3
4
5
Perfectly