big o notataion

2
BEST CASE, Worst Case And Big O Notation Transve rse Insert Delete Max value Linear search Binary search Complexity Best case No best case If we want to insert an elemen t at the last positi on of an array. If we want to delete the last elemen t of an array. When our array is arrange d in descend ing order i.e. the first element of an array is the largest . When we found the elemen t at the first positi on of an array. When the value we want to find is at the middle of an array. Worst case No worst case If we want to insert an elemen If we want to delete the first When our array is arrange d in When we found the elemen t at When the value we want to

Upload: saqib-iqbal

Post on 25-Sep-2015

215 views

Category:

Documents


1 download

DESCRIPTION

Explain the best and worst case and big O notation of algorithms for traverse, insert, delete, linear search, binary search and finding max value in a given array..

TRANSCRIPT

BEST CASE, Worst Case And Big O Notation

TransverseInsert DeleteMax valueLinear searchBinary search

ComplexityBest case No best caseIf we want to insert an element at the last position of an array.If we want to delete the last element of an array.When our array is arranged in descending order i.e. the first element of an array is the largest.When we found the element at the first position of an array.When the value we want to find is at the middle of an array.

Worst caseNo worst caseIf we want to insert an element at the first position of an array.If we want to delete the first element of an array.When our array is arranged in ascending order i.e. the last element of an array is the largest.When we found the element at the last position of an array.When the value we want to find is at the first or at the last position of an array.

Big oO(n)O(n)O(n)O(n)O(n)O(log n)