Algorithms Flashcards

1
Q

What is Abstraction?

A

Removing any unnecessary details/information from a problem in order to solve it

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

What is decomposition?

A

Breaking down a problem into smaller, simpler steps/stages

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

What is an algorithm?

A

A series of steps that a program has to perform in order to solve a problem

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

look at this list of integers:
12 34 54 76 89 13 24
using a linear search, how many items would you have to check to reach the value 13

A

I would have to check 6 values until I reach the value 13

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

Why wouldn’t a binary search work on the following data?

cow , apple , moose , dog , bird

A

Because the data is not in the correct order/ is not in order

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

complete a binary search on this data to find the value 450

12 34 56 78 99 102 345 450 567

A
  1. start from the middle value 99,is smaller than the value needed therefore values 12 to 99 are removed from the list
  2. Next is value 450, its been found!
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How does a bubble sort work?

A

a bubble sort repeatedly goes through a list, comparing each pair of adjacent elements. If they are in the wrong order they are swapped.

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

What is an insertion sort?

A

An sorting algorithm that sorts one item of data at a time, repeats this process until the list is sorted

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