algorithms Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

what are the three types of computational thinking and describe them

A

abstraction- ignoring the specific details deemed irrelevant to the task and only focusing on the important information involved
decomposition- the process of breaking a large problem down into a much smaller one, solving each one, one step at a time
algorithmic- solving the problem in a logical manner whilst taking the appropiate steps.

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

state the two searching algorithms

A

binary

linear

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

describe a linear search

A

the algorithm goes through each number on the list, determining whether or not its the number its looking for, untill it reaches the correct number

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

describe a binary search

A

the algorithm finds the midpoint of an ordered list. if the midpoint is not equal to the number its looking for, it discards one half of the list, dependant on whether or not the number its looking for is smaller or larger than the midpoint. this process of midpoint and discard continues until it has found the desired number

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

state the three types of algorithmic sorting

A

merge
bubble
insertion

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

describe how a merge sort works

A

the algorithm keeps halfing the list until it reaches singular values. once this has happened, it begins joining them up again, but this time comparing each value to determine its place in the list

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

describe how a bubble sort works

A

groups each value into pairs, comparing them and swapping them if necessary. Highest number always end up on the end of the list

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

describe how an insertion sort works

A

takes the second value of the list and then compares it to the last, determining whether or not to swap them. process continues until the list is completed. End up with two sections of the list: sorted and unsorted on the right

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

what is pseudocode

A

an informal coding language that cannot be used to code

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

give the flow diagram symbol for each of the following

  • start/stop
  • decision
  • input/output
  • process
A
  • oval
  • diamond
  • parallelogram
  • rectangle
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

pseudocode for a linear search

A
for item in dataset
if item == target then
return true
endif
endfor
return false
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

pros of a binary search

A

-it’s more efficient than linear

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

cons of a binary search

A

-data set has to be ordered prior to programme running

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