## Find Median of Two Sorted Arrays

The question is to find the median of two sorted arrays of numbers. Write an algorithm running in O(log n) time. The median of a list of numbers is the middle one when the list is sorted. When the list

Posted in Algorithm

## Big Oh Notation

Big Oh notation describes the limiting behavior of a function $$f(n)$$ when its argument approaches infinity. Let $$f,g$$ be two functions on positive numbers. We write $$f = O(g)$$ if there exists $$c>0$$ such that $$f(n)\leq c \cdot g(n)$$ for

Tagged with:
Posted in Algorithm, Theory

## Print All Permutations of Sets

A permutation of a set is an arrangement of the elements in a particular order. For example, there are two permutations of {1,2}, namely {1,2} and {2,1}, and 6 permutations of {1,2,3}, namely {1,2,3}, {1,3,2}, {2,1,3}, {2,3,1}, {3,1,2}, and {3,2,1}.

Tagged with: ,
Posted in Algorithm, Java

## Array Circular Shift

The problem is to rotate elements in an array in a circular way. For example, shifting the array {38, 27, 43, 3, 9, 82, 10} 3 positions to the left produces {3, 9, 82, 10, 38, 27, 43} Using a

Tagged with:
Posted in Algorithm, Java