2.1 Algorithms Flashcards

1
Q

Define linear search

A

A sequence that checks every item in a list 1 by 1 until it finds the desired item.

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

Define binary search

A

A sequence that finds the desired item of a list according to the midpoints.

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

What happens if the midpoint is greater than the desired item?

A

It scraps the midpoint and the data to its left and checks again.

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

What happens if the midpoint is smaller than the desired item?

A

It scraps the midpoint and the data to its right.

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

Define bubble sort

A

Bubble sort makes multiple passes through a list. It compares items and changes those that are out of order. Each pass through the list places the next largest value in its proper place.

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

How are numbers sorted in bubble sort?

A

Compares 1st 2 items and swaps them if necessary.

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

Define pass

A

A full cycle of swapping (doesn’t mean list is sorted).

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

Define insertion sort

A

A more efficient version of bubble sort. Each pass would insert each number into its correct place.

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

How are numbers sorted in insertion sort?

A

Compares 1st 2 items and inserts the necessary item into its complete correct position rather than swapping them. Has 2 lists, unsorted and sorted.

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

Where is insertion sort very efficient?

A

A small data set or where data is mostly sorted.

E.g. a pack of cards.

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

What is merge sort?

A

An efficient sequence that divides an unsorted list into sublists with 1 item each and merges the lists together until it has a complete sorted list.

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

Define computational thinking

A

Use of computers to solve problems.

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

Define abstraction

A

Representing “real world” problems in a computer using variables and symbols and removing unnecessary elements from the problem.

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

Define decomposition

A

Breaking down a large problems into smaller sub-problems.

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

Define algorithmic thinking

A

Identifying the steps involved in solving a problem.

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