2.1 New Flashcards

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

3 principles of algorithmic thinking

A

-abstraction
-decomposition
-algorithmic thinking

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

abstraction

A

the process of removing unnecessary details of a problem of focus on the important features to implement in a solution

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

examples of abstraction

A

map of a bus or train route in a city

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

decomposition

A

the process of breaking down a large problem into a set of smaller problems

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

benefits of decomposition

A

-smaller problems are easier to solve
-each smaller problem can be solved independently of the others
-smaller problems can be tested independently of the others
-smaller problems can be combine to produce a solution to the full problem

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

algorithmic thinking

A

the process of creating step-by-step instructions in order ro produce a solution to a problem

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

how can you use algorithmic thinking to identify each step

A

-using abstraction and decomposition

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

what should you do after identifying each step in algorithmic thinking

A

a precise set of rules can be created and the problem will be solved

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

2 common searching algorithms

A

binary search
linear search

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

binary search

A

halving a dataset by comparing the target value with the middle value, going left if smaller, right if bigger until it finds the value or realises it is not there

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

conditions to perform a binary search

A

data must be in order

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

steps a binary search will follow to look for a number

A
  1. select the middle number
  2. check if selected number is equal to the target number
  3. if searched number is larger discard left half, or if searched number is smaller, discard right half
  4. repeat until number is found or remaining list size is 1 or 0
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

linear search

A

starts with the first value in a dataset and checks every value one at a time until all values have been checked

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

conditions for a linear search

A

no conditions, does not have to be in order

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

steps to perform a linear search

A
  1. check the first value
  2. if the value is equal to the target value, stop
  3. else move to the next value and check
  4. repeat until all values have been checked or the vale looking for is not found
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

advantages of binary search

A
  1. fast for large dataset
  2. efficient for repeated searches
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

disadvantages of binary searches

A
  1. dataset must be in order
  2. more complex to implement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

advantages of linear search

A
  1. works on unsorted datasets
  2. faster on very small datasets
  3. simple to understand and implement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

disadvantages of linear search

A
  1. slow for large datasets
  2. inefficient, starts at the beginning each time
20
Q

3 sorting algorithms

A
  1. bubble sort
  2. merge sort
  3. insertion sort
21
Q

bubble sort

A

sorting algorithm that starts at the beginning of a dataset and checks values in pairs and swaps them if they are not in the correct order

22
Q

name of one full run of bubble sort

A

pass

23
Q

when is the bubble sort done

A

when there are no more swaps to make

24
Q

how to preform bubble sort

A
  1. compare the first two values in the dataset
  2. if they are in the wrong order then swap them
  3. compare the next two values
  4. repeat step 2 and 3 until you reach the end of the dataset (pass 1)
  5. if you have many any swaps repeat from the start
  6. if you have not made any swaps, stop
25
Q

merge sort

A

sorting algorithm that uses the ‘divide and conquer’ strategy of dividing a dataset into smaller sub-datasets and merging them back together in the correct order

26
Q

how to perform a merge sort

A
  1. divide the dataset into individual datasets by repeatedly splitting the dataset in half (divide)
  2. merge pairs of sub-datasets together by comparing the first value in each dataset
  3. repeat step 2 until all sub-datasets are merged together into one dataset
27
Q

how to perform insertion sort

A
  1. take the first value in the dataset, this is now the sorted list
  2. look at the next value in the dataset and compare it to the first value
  3. if it smaller, insert it into the correct position to the left
  4. else keep it in the same position
  5. repeat step 2,3 and 4 until all values in the dataset have been compared
28
Q

input

A

data or information being entered into a program before it is processed in the algorithm

29
Q

sources of input

A

USER: keyboard, mouse, controller, microphone
SENSORS: temperature, pressure, movement

30
Q

what is a process

A

a doing action performed in the algorithm than transforms inputs into the desired output

31
Q

output

A

the result of the processing in an algorithm and usually the way a user can see if an algorithm works as intended

32
Q

examples of outputs

A

numbers
texts
images
actions

33
Q

structure diagram

A

-visual representation of problem decomposition
-a tool to show how a complex problem can be broken down into more manageable sub problems
-planning tool for developers during the analysis of a problem

34
Q

tools to describe algorithms

A
  1. pseudocode
  2. flowcharts
35
Q

pseudocode

A

-text based tool that uses short English words or statements to describe an algorithm
-more structured than writing sentences in English

36
Q

OCR reference language

A

the officially designed pseudocode that is seen in OCR based exams to describe algorithms

37
Q

flowchart

A

visual tool that uses shapes to represent different functions to describe an algorithm

38
Q

logic error

A

incorrect code is used that causes the program to run, but produces an incorrect output or result

39
Q

examples of logic erros

A

-incorrect use of operators
-logical operator confusion
-looping one extra time
-indexing arrays incorrectly
-using variables before they are assigned
-infinite loops

40
Q

syntax errors

A

an error that breaks the grammatical rules of a programming language and stops it from running

41
Q

examples of syntax errors

A

-typos and spelling errors
-missing or extra brackets or quotes
-misplaced or missing semicolons
-invalid variable of function names
-incorrect use of operators
-incorrectly nested loops and blocks of code

42
Q

trace tables

A

used to rest algorithms and programs for logic errors that appear when an algorithm or program executes
-each stage of the algorithm is executed step by step
-inputs, outputs, variables and processes can be checked for the correct value when the stage is completed

43
Q

what can trace tables be used with

A

flowcharts, pseudocode or program code

44
Q

what can a tract table be used to

A

discover the purpose of an algorithm by showing output data and intermediary steps
-recording the state of the algorithm

45
Q
A