We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
UNIT – I : HandOut
Algorithm: A step by step process to perform a particular task.
Algorithm Features: Input/Output, Finiteness, Definiteness, Effectiveness, Generality Performance Analysis: Determining an estimate of the time and memory requirement of the algorithm. • Time estimation is called time complexity analysis • Memory size estimation is called space complexity analysis. Notations used to represent Time Complexity: Big-O Notation : f(n)=O(g(n)) iff there exist a positive constant C and non-negative integer n0 such that f(n) <= Cg(n) for all n>n0. O-notation measures the best case time complexity Omega Notation: f(n)=Ω(g(n)) iff there exist a positive constant C and non-negative integer n0 such that f(n) ≥ Cg(n) for all n> n0. Ω-notation measures the best case time complexity or the best amount of time an algorithm Theta Notation: f(n) = Θ(g(n)) iff c1g(n) < f(n) <c2g(n) for all n>N Recursion: Process of calling a function by itself. Recursion Types: Direct recursion, Indirect recursion., Linear Recursion, Binary Recursion, Tail Recursion Searching: Mechanism used to find the location of an element in the list of data stored. Linear Search: Referred as Sequential Search in which the required element is searched linearly through out the search list. Binary Search: Searches for a key in an ordered list of data elements, by halving the search list with each comparison until the key is either found or not found. This is also known as logarithmic search or bisection. Analysis for Search Algorithms: Time Complexity Best Average Worst Case Case Case Linear Search O(1) O(n) O(n) Binary Seacrh O(1) O(log2 n) O(log2 n)
Sorting: The process of rearranging the elements of a list either in ascending or in
descending order. A sorting method is said to be stable when it has the minimum no. of swaps. Stable sorting methods are - Bubble Sort, Selection Sort & Quick Sort Unstable Sorting methods are – Insertion Sort, Merge Sort Bubble Sort: Also known as Exchange Sort. . Time Complexity Best Average Worst Case Case Case Insertion Sort O(n) O(n2) O(n2) Selection Sort O(n2) O(n2) O(n2) Bubble Sort O(n2) O(n2) O(n2)