someone said that the solutionhas been given using the stack, can someone
explain it, i did a lookup in my mail box and the solution for the
histogram problem is not there. The gif tells how to proceed, however, not
able to map it to how stack to be used.

Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652


On Mon, Jan 23, 2012 at 10:57 AM, Ashish Goel <ashg...@gmail.com> wrote:

>  You are given an array which represents the heights of every bar of a
> histogram. Now all these bars are contiguous (juxtaposed wrt each other)
> and have the same width.
> For Example, A={2,1,4} represents a histogram having 3 bars of height
> 2,1and 4 in that order. Now you need to find a rectangle in this histogram
> that has the maximum area.
> See figure: http://www.ocf.berkeley.edu/~wwu/YaBBAttachments/hist_rect.gif
>
> Time Complexity: O(n)
> Space Complexity:O(1)
> let the histogram given is 1,2,1,4,3,2,2,3,1,4,1,1,1,1,1,1
>
> the max is 16,  when i trying to use Ldistance, it is coming as 10.
>
> Alternatively, the logic of finding with all the consecutive bars
> following a particular bar which are non-ascending is O(n^2)
>
>
> any solutions?
>
>
>
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to