1.9 Algorithms and Programs Flashcards

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

What is an algorithm?

A

An algorithm is a set of mechanical and sequential steps that are followed in order to take an input and process it in to an output

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

Considerations when using inputs and outputs

A

Data types, Structure of the data, validation, number of arguments, where the input/ouput will go, are the any preconditions

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

what is a variable

A

A variable is a named location in the computers memory that a programmer can use to store data whilst the program is running

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

what is a constant

A

A constant is a variable that cannot be changed during the duration of the program

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

global variables

A

Can be used throught the entire program

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

Local variables

A

Can only be used within their subroutine

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

What are the two kinds of subroutines

A

Procedures, functions

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

What are procedures

A

Procedures are subroutines that don’t return a value, normally used to output something

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

What are functions

A

Functions are subroutines that return a value

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

What are the two different search algorithms

A

Binary, linear

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

what are the benefits of binary search algorithms

A

They are efficient

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

What are the disadvantages of binary search algorithms

A

They require the data set to already be sorted

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

what are the advantages of linear search algorithms

A

They don’t require sorted data sets
They can search through data sets that hold different kinds of data

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

What are the disadvantages of linear search algorithms

A

They are slow if the data set is long

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