Data Structures & Algorithms - Chapter 7 & 11 QUIZ
Bounds Checking (def)
If there are more elements than declared in the array
What is the best case scenario for an algorithm?
You run your algorithm many times and it finds the best case
What factors affect the run time of an algorithm?
- Computer hardware (Memory, Cache, Bus Speed, etc.) - Compiler - Algorithm used - Input size to the algorithm
Incorrect Algorithm Characteristics
- Might not halt at all on some inputs - Might halt with other than desired answers
What are the two concepts involved in Algorithm Analysis?
- Space Complexity - Time Complexity
Rankings of Best Algorithms by Growth Function
1) Constant 2) Logarithmic 3) Linear 4) Exponential 5) Polynomial
The Four Steps of an Algorithm
1) Define the problem 2) Designing different ways to solve the problem 3) Algorithm Analysis 4) Implementation of Algorithm
What are the two ways data is stored?
1) Linear (Queue, Stack) 2) Non-LInear (tree)
What are the resources that an algorithm uses?
1) Memory 2) Communication Bandwidth 3) Computational Time
For any algorithm...
1) Represent it as a function 2) Determine the growth pattern 3) The growth of the fastest growing term is the Big-Oh
What are the four ways to manage data?
1) Store 2) Add 3) Delete 4) Retrieve
What is better? Algorithmic improvement or hardware improvement?
Algorithmic improvement
Is an array a class or an object?
An object; it must instantiated before it can be used
What type of complexity is O(1)?
Constant
What type of complexity is O(2^n)
Exponential
Algorithm (def)
Finite set of instructions, that if executed correctly, accomplishes a task in a finite amount of time
What type of complexity is O(n)?
Linear
What type of data structure is an array?
Linear
What type of complexity is O(n log n)?
Logarithmic
We type of algorithms do we analyze?
Only correct algorithms
What type of complexity is O(n^2)?
Polynomial (quadratic)
Analyzing and Algorithm (def)
Predicting the resources the algorithm requires
Growth Function (def)
Shows the relationship between the size of the problem (n) and the value we hope to optimize
What is the worst case scenario for an algorithm?
The maximum amount of time the algorithm takes to solve the problem
Asymptotic Complexity (def)
The term that increases the most quickly as 'n' increases
What is the average case scenario for an algorithm?
Trying to find random inputs
When is an algorithm correct?
When after an input is given, it halts on the correct output
Time Complexity (def)
how much time does it take to run the algorithm (time from CPU)
Space Complexity (def)
how space is required (RAM)
Data Structures (def)
how to manage data