Algorithmic Strategies - Formula Sheet
Essential Formulas and Complexities
1. Search Comparison Formulas
Average Comparisons in Sequential Search:
Average Comparisons = (n + 1) / 2
Where n represents the total number of elements in the search list.
2. Complexity Bounds
Linear Search Time Complexity:
- Best Case: O(1)
- Worst Case: O(n)
- Average Case: O(n)
Binary Search Time Complexity:
- Best Case: O(1)
- Worst/Average Case: O(log n)
Sorting Time Complexities (Bubble, Selection, Insertion Sorts):
- Best Case (Optimized Bubble/Insertion): O(n)
- Worst/Average Case: O(n^2)
3. Space Complexity Components
The total memory required by an algorithm is represented as:
S(P) = C + S_P(I)
Where:
- C: The fixed part representing memory space required for simple variables and constants.
- S_P(I): The variable part representing space required by variables whose size depends on the problem instance characteristics (such as recursive stack space).
4. Fibonacci Sequence Formula
The mathematical recurrence relation used in the dynamic programming approach for Fibonacci series generation is:
Fib(n) = Fib(n-1) + Fib(n-2)
With base cases defined as Fib(0) = 0 and Fib(1) = 1.
More for this chapter
Book Back Questions10 textbook MCQs · solved
Additional MCQs15 extra MCQs · solved
Practice TestInteractive · instant score
Book Back TestTest yourself on the textbook set
Additional MCQ TestTest yourself on the extra set
Study NotesConcepts & methods
More chapters in Computer Science
View all
1 Function
2 Data Abstraction
3 Scoping
5 Python -Variables and Operators
6 Control Structures
7 Python functions
8 Strings and String manipulation
9 Lists, Tuples, Sets and Dictionary
10 Python Classes and objects
11 Database Concepts
12 Structured Query Language (SQL)
13 Python and CSV files
14 Importing C++ programs in Python.
15 Data manipulation through SQL
16 Data visualization using pyplot: line chart, pie chart and bar chart