Analysis tools Flashcards
List all the seven functions in ascending order
- Constant
- log n
3, Linear - n log n
- quadratic
- cubic
- exponentia;
What is a data structure? What is an Algorithm? And how do they affect runtime
A data structure is a systematic way of organizing and reaching data.
An algorithm is a set of instructions specifying how a specific task must be done within a finite amount of time
They affect runtime deciding how quickly accessible the data in the data structure is, which in turn affects runtime
How would you perform experimental studies on an algorithm?
Run the algorithm on a machine, test the algorithm with various input, measure the time the algorithm takes to run by using system.currenttimemillis() and record the results
What are the limitations of Experimental studies?(3)
- It is sometimes impractical to test all possible input
- The results will not be the same across different machines unless the hardware, software and other contributing factors are exactly the same
- You have run the whole algorithm in order to analyze it and who knows how long that will take
Why is runtime analysis better?(3)
- It takes into account all inputs
- Will analyze the algorithm without implementing it
- Will analyze the algorithm the same regardless of hardware and software