# 1.9 Algorithms and Programs 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

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

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

4
Q

what is a constant

A

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

5
Q

global variables

A

Can be used throught the entire program

6
Q

Local variables

A

Can only be used within their subroutine

7
Q

What are the two kinds of subroutines

A

Procedures, functions

8
Q

What are procedures

A

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

9
Q

What are functions

A

Functions are subroutines that return a value

10
Q

What are the two different search algorithms

A

Binary, linear

11
Q

what are the benefits of binary search algorithms

A

They are efficient

12
Q

What are the disadvantages of binary search algorithms

A

They require the data set to already be sorted

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

14
Q

What are the disadvantages of linear search algorithms

A

They are slow if the data set is long