you are given a M x N matrix with 0's and 1's
find the matrix with largest number of 1,
1. find the largest square matrix with 1's
2. Find the largest rectangular matrix with 1's
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
Yes there definitely is a fine distinctions between the two cases you
mention.
The program above fills the N*N numbers in spiral in decreasing order and
then prints the matrix contents left to right , top to bottom.
For the second program (that also prints in spiral order):
On Wed, Apr 28, 2010 at 1:18 AM, Ashish Mishra amishra@gmail.comwrote:
How to build BST from binary tree in place i.e without extra space ??
Are you looking for:
http://discuss.joelonsoftware.com/default.asp?interview.11.781167.4
--
You received this message because you are
pickup node in any order no matter(pre,post,inorder) and just one by
one. start adding the node into bst no need to use extra space u have
to just ditach the node from binary tree and attach it in bst.
On Wed, Apr 28, 2010 at 1:18 AM, Ashish Mishra amishra@gmail.com wrote:
How to build BST
@ Rajesh: there may be a problem with this solution.
Suppose I start detaching the nodes from the binary tree in the following
order - Root, Left, Right.
So as soon as i detach the root of the binary tree and form a new BST with
it ( on which i m going to make further node additions), I am left
@rajesh can u explain your soln
how u r doing inorder, pre or whatever (without using stack) and at same
time build BST
On Wed, Apr 28, 2010 at 3:30 PM, Rajesh Patidar patidarc...@gmail.comwrote:
pickup node in any order no matter(pre,post,inorder) and just one by
one. start adding the node
@Rajesh Patidar
I think we should do in Post order traversal alone. If we go by
Preorder/Inorder we might lose track of children node that is currently
being inserted into the BST. - correct me if im wrong :)
On 28 April 2010 15:30, Rajesh Patidar patidarc...@gmail.com wrote:
pickup node in
Let Memo[i][j] be the sum of elements in the (sub) rectangle from (0,0) to
(i,j)
Then use principle of inclusion and exclusion to find the sum of elements
from (a, b) to (c, d) in O(1)
for N*N matrix, Complexity is O(N^4)
On 28 April 2010 13:36, Ashish Mishra amishra@gmail.com wrote:
you
my choice is build a min heap .sort the array with heap sort.then find the
median of the sorted array and build tree
On Wed, Apr 28, 2010 at 10:16 PM, Vivek S s.vivek.ra...@gmail.com wrote:
@Rajesh Patidar
I think we should do in Post order traversal alone. If we go by
Preorder/Inorder