2.1 Algorithms Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Abstraction

A

Removing unimportant parts of a problem in order to concentrate on those that are important

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

Decomposition

A

Breaking down a problem into smaller more manageable ones

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

Algorithmic thinking

A

An approach to solving problems by the use of algorithms (sequence of steps that lead to a solution)

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

Structured diagram

A

A hierarchical diagram that shows how a problem is broken down into sub-sections/sub-tasks

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

Why is a structured diagram used?

A

To show how a program is decomposed

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

Linear search

A
  1. Look at the first item in the list
  2. Check if the item is equal to the search term
  3. If the current item is the same as the search term, the item has been found. Otherwise, move to the next item in order.
  4. Repeat from step 2 and 3 until the last item in the list has been reached
  5. If the end of the list has been reached and the search term has not been found, then the search term is not in the list and the algorithm can stop.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Binary search prerequisite

A

List must be ordered

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

Binary search

A
  1. Select the midpoint
  2. Check if searched value is equal to midpoint value (not compare). If so, the search will stop
  3. If the searched value is larger, discard the left half; if it is smaller, discard the right
  4. Repeat steps 1-3 until item found or remaining list is of size 1 and item not found
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Bubble sort

A
  1. Start with the leftmost item
  2. Compare this item with the one next to it
  3. If the one next to it is less, swap the items
  4. Repeat for all the other items
  5. At the end of one pass through the list, the largest item is at the end of the list
  6. Repeat the process until the items are sorted
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Merge sort

A
  1. Divided the unsorted list in two
  2. Continue to divide these lists into two until there is just one item in each list
  3. Read item from list A
  4. Read item from list B
  5. Write smaller to output list
  6. Read next item from the list that held the smaller value
  7. Repeat until all items written to output list
  8. Repeat 3-7 until only one list is remaining
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does linear sort do?

A
  • This algorithm sorts one data item at a time
  • The list is split to sorted set/part and unsorted set/part
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Linear sort

A
  1. One item is taken from the unsorted set, and placed in the correct position in the sorted set
  2. This is repeated until there are no more unsorted items in the list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly