S1 - Algorithms (Done) Flashcards

1
Q

What is computational thinking ?

A

The steps you take to find the best solution to a complex problem.

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

What are the three key techniques for computational thinking ?

A

Decomposition, abstraction and algorithmic thinking.

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

What is 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
4
Q

What is abstraction ?

A

Picking out the important bits of info from a problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
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
6
Q

What is pseudo-code ?

A

Not an actual programming language, follows a similar structure without worrying about the syntax. Quick to write and easily converted into other programming languages.

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

What are the two main search algorithms ?

A

Binary and linear search.

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

When are binary and linear searches used ?

A

Binary searches are used in an ordered list, whereas a linear search is used in an un-ordered list.

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

How would you find the middle item in a list ?

A

make the length of the list n, and do (n + 1) ÷ 2 and round up if necessary.

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

How would you complete a binary search ?

A

Find the middle item, if it’s the one you’re looking for stop, else middle item is more than desired item - get rid of second half of the list, if the middle item is less than the desired item get rid of the first half. repeat this with each new list until you have desired item.

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

How would you complete a linear search ?

A

Look at the first item in the list, if it’s the one you’re looking for stop, else look at the next item. Repeat this until you’ve either reached the end of the list or found the desired item.

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

What are the two sorting algorithms ?

A

A bubble sort and merge sort.

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

How do you do a bubble sort ?

A

Look at the first pair of integers and swap them if they’re in the wrong order, move on to the next pair and do the same. Repeatedly do this until you get to the end of the list, called one pass. Repeat all of this until there are no swaps in a pass.

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

What are the advantages of a bubble sort ?

A

It’s simple and can be easily implemented on a computer, and it’s an efficient way to check if a list is already in order, and it doesn’t use very much memory as all sorting is done using the original list.

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

What are the disadvantages of a bubble sort ?

A

It’s an inefficient way to sort a list (worst case it’ll do (n(n-1)) ÷ 2 comparisons), and because of this it’s pretty slow for very large lists.

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

How do you do a merge sort ?

A

Split the list in half, with the second sub-list starting with the middle term, and keep doing this until each sub-list contains one item. Then merge pairs of sub-lists, doubling the items, each time sort the items into the right order - until all the sub-lists are merged and are in the right order.

17
Q

What are the advantages of a merge sort ?

A

Generally more efficient than a bubble sort algorithm for larger lists, and similar for short lists. It also has consistent running time regardless of the order of items in the original list.

18
Q

What are the disadvantages of a merge sort ?

A

Even if the list is already sorted it goes through the whole process, so bubble sort may be quicker in some cases, and it uses more memory as it has to create additional lists.

19
Q

What is the difference between a linear and binary search ?

A

Linear search is much simpler, but not as efficient - however linear search’s biggest advantage is it can be used on any list. In small ordered lists difference in efficiency doesn’t matter so run time will be similar, in big lists binary search’s run time will be shorter than a linear search.

20
Q

In a flow chart what represents a start or stop ?

A

Boxes with rounded corners, at the beginning and end of an algorithm.

21
Q

In a flow chart what represents inputs or outputs ?

A

Parallelogram boxes, holds anything that goes in or out of the algorithm.

22
Q

In a flow chart what represents processes ?

A

Rectangular boxes, contains general instructions, processes and calculations.

23
Q

In a flow chart what represents a decision ?

A

Diamond boxes, containing yes or no questions with two paths it can follow depending on this.

24
Q

In a flow chart what represents a subroutine ?

A

Rectangular boxes with additional lines on either end, referencing other flowcharts.

25
Q

In a flow chart what does an arrow represent ?

A

The direction the algorithm should move in, and connect the boxes.