The theoretical analysis of algorithms is one of the trickier topics to get the hang of when it comes to learning the fundamentals of computer science, however once you understand the basic concepts, with practice it begins to get easier.
The Basics:
The RAM model (Random Access Machine) is a form of algorithm analysis where we simplify how many steps it takes to perform particular computational tasks. For example,
Best, Worst and Average Case Complexity:
Complexity analysis is used to understand how good or bad an algorithm is over all instances (combinations) of data that the algorithm can accept.
The Basics:
The RAM model (Random Access Machine) is a form of algorithm analysis where we simplify how many steps it takes to perform particular computational tasks. For example,
- Conditional statements (if, switch/case) and method calls are counted as 1 step.
- Loops (for, while) are counted by the maximum number of times they can loop.
- Memory access is counted as 1 step.
Best, Worst and Average Case Complexity:
Complexity analysis is used to understand how good or bad an algorithm is over all instances (combinations) of data that the algorithm can accept.