Algorithms Flashcards

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

An algorithm

A

A series of steps taken to complete a task.

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

Two ways to present algos

A

Flow charts

Pseudo code

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

Decomposition is

A

Breaking down on large problem into several smaller sub problems

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

Decomposition advs

A

Easier for teams to tackle problems

Easier to solve

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

Abstraction

A

Removal of unecessary details from a problem

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

Abstraction is used in what and advs

A

Weather models

Makes it less cluttered and easier to see the problem

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

Computational thinking concepts

A

Algorithmic thinking
Abstraction
Decomposition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
Algorithm symbols for 
Start/End 
Process 
Input/output 
Decisions
A

Oval
Rectangle
Parallelogram
Diamond with yes down and no to the side

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

3 basic programming constructs

A

Sequence
Iteration
Selection

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

Sequence

A

The order in which execution occurs

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

Selection (pseudocode)

A

If then else (pseudo code)

Choose between two options

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

Iteration (pseudocode) and types

A

Repetition of instructions
For loop - definite amount of times action must be repeated eg for 5
Repeat until - indefinite iteration - condition controlled - until it is true wont move on
While loop - action occurs only while the condition is true

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

Two search algorithms are

A

Linear search

Binary search

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

Linear search is

A

When data is unsorted, you start at the beginning and search through every item till you find it. Eg
Start at first name
Repeat
Examine current name
IF it’s the one you’re looking for THEN
END IF
UNTIL found = true

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

Binary search is

A

If the list is sorted in binary or alphabetical order. Repeatedly divide the the data in half till there is only item in the list
Eg
We are trying to find the number 100
We start at fifty
If the number at fifty is lower then we discard everything in the first half and keep on halving the second half till we find it

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

Linear search and binary search advantages and disadvantages

A

LS is hard for large items cos it will take longer

Binary is quicker but only works on sorted lists

17
Q

Two ways to sort algorithms

A

Bubble sort

Merge sort

18
Q

Bubble sort is

A

Repeatedly swapping adjacent elements into the correct order
Eg we want numbers of temp in ascending order it will keep 3&6 the way they are and swap 10& 9.
So from 3 6 10 9
It changes to 3 6 9 10

19
Q

Merge sort

A

Stage 1 - list is divided in half until each sub list has a length of one
Stage 2 - each pair of sub lists are repeatedly merged to produce new sorted sub lists that then are in order eg
42 31 12 3
Becomes one length long
Then 41 & 31 are swapped & so is 12&3
So 3 12 31 41

20
Q

Compare merge sort and bubble sort

A

Bubble sort is slow and inefficient for lists that are longer than 3 or 4
Merge sort is a difficult algorithm and hard for inexperienced users