1 - Algorithms Flashcards
1
Q
Describe an algorithm. (1)
A
A finite sequence of step-by-step instructions carried out to solve a problem.
2
Q
In a list of 8 numbers, what is the middle number? (Sorting)
A
5
3
Q
In a flow chart: describe the shapes used for Start/End, Instruction and Decison
A
Rounded rectangle, rectangle, diamond
4
Q
How is the lower bound of a bin packing algorithm found? (2)
A
Sum the terms, and divide by number of bins.
Always round up.
5
Q
What is the order of an algorithm?
A
A measure of its efficiency as a function of the size of the problem.
6
Q
An algorithm has order nlogn, and can sort 100 items in 0.3 seconds. Estimate the time needed for 100 items.
A
0.3 x (1000log(1000) / 100log(100))
= 0.3 x 15
= 4.5