ALGORITHMS Flashcards

(16 cards)

1
Q

What is DECOMPOSITION

A

breaking a complex problem into smaller problems and solving each one individually

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

WHAT IS ABSTRACTION

A

picking out important bits of information from the problem and ignoring specific detail which don’t matter

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

what is ALGORITHMIC THINKING

A

a logical way of getting from the problem to the solution.

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

what is computational thinking important

A

decomposition, abstraction and algorithmic thinking is used to turn a complex problem into small problems that a computer can then help to solve

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

whats the purpose of pseudocode

A

clearly shows and algorithm’s steps without worrying about the finer details of any particular programming language

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

why are the advantages of using pseudocode

A
  • quick to write
  • can be easily converted into any programming language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what are the 4 different shapes you need to know for flowcharts

A

start/end = rectangle with rounded corners
inputs/outputs = parallelogram
processes = rectangles
decisions = diamond

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

How does binary search work

A
  1. find the middle item in a ordered list
  2. check if this middle item is the item you are looking for
  3. if not, compare item you are looking for with this middle item. If item is greater than middle item, get rid of anything before the middle value. If item is less than middle item, get rid of anything after the middle value
  4. repeat steps 1-3 with the new list with less items until you find the item
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how does linear search work

A
  1. look at first item in any list
  2. check to see if this item is the item you are looking for
  3. if not, move onto next item in the list
  4. repeat steps 2-3 until you find the item or you have check every item in the list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what are the advantages and disadvantages of binary and linear search

A

linear:
- simpler than binary search
- can be used on any list (ordered and unordered)

  • inefficient, can only be used in small lists

binary:
- more efficient than linear search

  • list has to be ordered
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How does bubble sort work

A
  1. look at first two items in the list
  2. check to see if they are in the right order. If it is, don’t do anything. If it not, swap them around
  3. move onto next pair of items (2nd and 3rd) and repeat step 2
  4. repeat step 3 until you reached the end of the list (1 pass). Last item is now in the correct place
  5. repeat steps 1-4 until they are no swaps in a pass
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what are the advantages and disadvantages of bubble sort

A

ADVANTAGES:
- simple algorithm
- efficient to check if list is already in order

DISADVANTAGES:
- inefficient way to sort a list
- not good for large lists binary

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

how does merge sort works

A
  1. split the list in half, creating 2 sub-lists
  2. repeat steps 1 until each list contains 1 item
  3. merge pairs of sub-lists so that each sublist has twice as many items. each time you merge, sort the items in the right order
  4. repeat steps 3 until all sublists are merged together
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what are the advantages and disadvantages of merge sort

A

ADVANTAGES:
- more efficient and quicker than all the other sorting algorithms
- consistent running time

DISADVANTAGES:
- slower than other algorithms for small lists
- not efficient at checking if list is ordered or not

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

how does insertion sort work

A
  1. look at second item in a list
  2. compare it to all the items before it and insert into correct place
  3. repeat steps 2 for every item until last item has been inserted into correct place
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

WHAT ARE THE ADVANTAGES AND DISADVANTAGES OF INSERTION SORT

A

ADVANTAGES:
- can be easily coded
- efficient with small lists
- very quick to add items to a ordered list
- good at checking if list is in order

DISADVANTAGES:
- not good with large lists