Optimal Binary Search Tree – Dynamic Programming Given a sorted array keys[0.. n-1] of search keys and an array freq[0.. n-1] of frequency counts,
Binary Search Tree
Cpp Algorithm – Find minimum s-t cut in a flow network – Graph Algorithm – In a flow network, an s-t cut is a cut that requires the source ‘s’
A Problem in Many Binary Search Implementations – Searching and Sorting – The above looks fine except one subtle thing, the expression “m = (l+r)/2”. It fails for large values of l and r. Specifically, it fails if the sum of low and high is greater than the maximum positive int value (231– 1).
Interpolation search vs Binary search – Searching and Sorting – On average the interpolation search makes about log(log(n)) comparisons(if the elements are uniformly distributed), where n is the number of elements to be searched.
Exponential Search – searching and sorting algorithm – The name of this searching algorithm may be misleading as it works in O(Log n) time.
TERNARY SEARCH – searching and sorting algorithm – The ternary search does less number of comparisons as it makes Log3n recursive calls, but binary search.
Jump Search – search and sorting algorithm – Jump Search is a searching algorithm for sorted arrays.Basic idea is to check fewer elements.
Linear Search – searching and sorting – algorithm -A simple approach is to do linear search, Start from the leftmost element of arr[] and one by one compare
Check for Identical BSTs without building the trees – Given two arrays which represent a sequence of keys. Imagine we make a Binary Search Tree (BST)