(Done) 2. Algorithms Flashcards

1
Q

List the three key techniques for computational thinking

A
  • Decomposition
  • Abstraction
  • Algorithmic Thinking
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Define decomposition

A
  • Breaking down 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
3
Q

Define abstraction

A
  • Picking out the important bits of information, ignoring the specific details that don’t matter
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define algorithmic thinking

A
  • A logical way of getting from the problem to the solution. If the steps you take to solve a problem follow an algorithm then they can be reused and adapted to solve similar problems in the future
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What conditions are required for a binary search to occur

A
  • The items in the list are ordered
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What conditions are required for a linear search to occur

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

List the five steps in a binary search

A
  • Find the middle item (n+1)/2
  • If not item, compare target and current items, if item, stop
  • If greater than current item, search second half of the list
  • If less than current item, search first half of list
  • Repeat indefinitely
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List the four steps in a linear search

A
  • Look at the first item in the unordered list
  • If this is the item you’re looking for, then stop the search
  • If not, look at the next item in the list
  • Repeat steps 2 and 3 until you have found the item you are looking for or you have reached the end of the list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Steps in a bubble sort

A
  • Look at the first two items in a list
  • If they’re in the right order, leave them, otherwise swap them
  • Move onto the next item pair and repeat the check
  • Keep completing checks and moving onto the next pair until you reach the end
  • Exclude the last term and repeat everything until no more swaps happen
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Pros of a bubble sort

A
  • Simple and easy to implement
  • Also allows you to check if a list is already in order
  • Doesn’t use much memory as all the sorting is done in the original list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Cons of a bubble sort

A
  • inefficient as its time consuming
  • Does not cope well with a long list of items
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Steps of a merge sort

A
  • Split the list in half, the second sub-list should contain the middle item
  • Repeat the splitting in half until each list only contains 1 item
  • Merge pairs of sub lists together so that each sub-list has twice* as many items. Each time you merge lists, sort the items
  • Repeat until all sub-lists are merged
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Pros of merge sorts

A
  • In general more efficient and quicker than bubble and insertion sorts
  • Consistent running time regardless of how ordered the items in the list already are
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Cons of merge sorts

A
  • Slower than other algorithms for small lists
  • Even if the list is already sorted, still goes through the splitting and merging process
  • Uses more memory than other sorting algorithms in order to create the separate lists
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Steps of an insertion sort

A
  • Look at the second item in the list
  • Compare it to all items in the list before it and insert the item into the right place
  • Repeat for the third, fourth, fifth etc. items until the last item in the list has been inserted in the right place
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Pros of insertion sorts

A
  • Easy to code
  • Very good with small lists
  • Very little additional memory required as all the sorting is done in the original list
  • Very quick at adding items to an already sorted list
  • Very quick at checking if a list is already sorted
17
Q

Cons of an insertion sort

A
  • Doesn’t cope very well with large lists
18
Q

What does this represent in a flow diagram

A
  • The start or end of a process
19
Q

What does this represent in a flow diagram

A
  • Selection (if/else)
20
Q

What does this represent in flow diagram

A
  • Suborutine
21
Q

What does this do in a flow diagram

A
  • An input or output operation
22
Q

what is a condition shape in flowcharts

23
Q

What is an input/output shape in flowcharts

24
Q

What is a process shape in flowcharts

25
What is a start/end shape in flowcharts