2.1 Algorithms Flashcards

1
Q

Principles of Computational 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 all unnecessary details and including only the most relevant details.

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

Decomposition

A

Breaking down a complex problem into smaller, more manageable parts.

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

Algorithmic thinking

A

A way of getting to a solution by identifying the individual steps needed.

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

Inputs

A

Anything that needs to be supplied to the program to meet its goals.

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

Processes

A

Which calculations must be performed while the program is running.

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

Outputs

A

What your program needs to output.

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

Types of Errors

A
  • Syntax errors
  • Logic errors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Syntax Errors

A

Errors that break the grammatical rules of a programming language and stop it from running.

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

Logic Errors

A

Errors that produce an unexpected output, however the program still runs.

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

Structure Diagrams

A

Help to illustrate problem decomposition. They use ‘Step Wise Refinement’
Each node should achieve a single task which can then be coded as a subprogram

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

Trace Tables

A

Take each line at a time and write out the state of each variable.

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

Flow Charts

A

A method of representing the sequence of steps in an algorithm in the form of a diagram.

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

A

Represents flow from one component to the next.

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

A

Process
E.g. Input

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

A

Input/output

17
Q

◧◨

A

Subroutine

18
Q

A

Decision
E.g. IF/ELSE

19
Q

A

Start/stop. Terminator.

20
Q

Types of Searches

A
  • Binary search
  • Linear search
21
Q

Binary Search

A
  1. Calculate the midpoint of data set.
  2. Check if that is the desired item
    IF desired item is lower than midpoint…
  3. Repeat on left half data set
    IF desired item is higher than midpoint…
  4. Repeat on right side of data set
  5. Repeat until item is found.
22
Q

Characteristics of Binary Search

A
  • Required data set to be ordered
  • More efficient than linear search
23
Q

Linear Search

A

Starting from the beginning of a data set, each item is checked against to see if it is the desired item.

24
Q

Characteristics of Linear Search

A
  • Will work on any storage device
  • Efficient for smaller data sets, not large ones.
25
Q

Types of Sorts

A
  • Bubble sort
  • Merge sort
  • Insertion sort
26
Q

Bubble Sort

A

Compares each item with the next and swaps them if they are out of order.
Algorithm ends when there are no more swaps.

27
Q

Characteristics of Bubble sort

A
  • Sorts an unordered list of items.
  • Most inefficient
  • Easy to implement
  • Popular for small data sets
28
Q

Merge Sort

A

Divide and Conquer method.
Creates two or more identical sub-problems from the largest problem and solves them individually, then combines their solutions to solve the large problem.

29
Q

Characteristics of Merge Sort

A
  • Very efficient
  • Works well for large data sets
30
Q

Insertion Sort

A

Inserts each item into its correct position in a data set.

31
Q

Characteristics of Insertion Sort

A
  • Useful for inserting items into an already sorted list.
  • Good for small data sets
  • Not good for large data sets
32
Q

Pseudocode

A

A simple way of describing a set of instructions in a manner that resembles a programming language.

33
Q

Advantages of Pseudocode

A
  • Can be quickly and easily converted into an actual programming language.
  • Easy to understand
  • Changes to the design can be incorporated easily
34
Q

Disadvantages of Pseudocode

A
  • Can be hard to see how a program flows
  • Time consuming.