Popular Posts

Friday, March 2, 2012

Problem:
Find the rectangle with maximum area under a histogram in linear time.
Solution:

Complexity:
O(n)
Code:

Tuesday, February 21, 2012

kth smallest element in the union of the two sorted arrays

Problem:
Given two sorted arrays A and B of length n, find the kth smallest element in the union of the two sorted arrays. Do so in Θ(lgn).
Complexity:
O(log N)
Code:

Wednesday, January 25, 2012

Lucene Example