@gaurav popli: how about this one??
findsummat(int arr[],int n)
{
int *sum ;
sum =(int*)malloc(sizeof(int)*n);
for(int i=0;iwrote:
> @piyush : sorry dude , didnt get your algo . actually you are using
> different array and i get confused which array to be considered when.
>
>
>
> On Mon
Let's try
{ reverse( $ a b a a b a a a b ... a^n b ) | n = 0,1,2,... } .
Note that m = n(n+1)/2 + n = O(n^2)
Think about adding suffixes to the tree from shortest to longest.
So suppose you are now adding something of the form
reverse( $ X a^L Y )
where L is the length of the longest run of
{ reverse( $ a b a a b b a a a b b b ... a^n b^n ) | n = 0,1,2,... }
On Mar 13, 12:47 am, reynald reni wrote:
> Construct an infinite family of strings over a fixed alphabet, where
> the total length of the edge-labels on their suffix tree grows faster
> than O(m), where 'm' is the length of the
Sorry, a small test showed a loop quitting one iteration too soon.
Here is the fix.
import java.util.Random;
public class ListCopy {
class Node {
int val;
Node next, other;
Node() { }
Node(int val, Node next, Node other) {
this.val = val;
@atul
read it ..
it's good but more or less like the histogram algo.. i wanted a DP.
approach..
here is some of wat i heard from a senior in colg..
1. at every index we can keep 4 variable
ht: height of max rectangle possible at index above current
wt width " " " "
Copying a full graph requires a BFS or DFS. But here we have a big
advantage. We know the nodes are linked in a single chain. So we
don't need to search to find all nodes. We can just use .next
pointers.
No matter how we do things, we will need Map(A) that returns the copy
of node A if it alre
@ Sourabh: check solution i have posted in below link
http://groups.google.com/group/algogeeks/browse_thread/thread/91a17f7c78c2319e/991d1c2625a62ff0?hl=en&lnk=gst&q=rectangle+of+max+sum+MS+Q#991d1c2625a62ff0
On Tue, Mar 13, 2012 at 10:26 PM, Sourabh Singh wrote:
> @ ALL
>
> finding square mat
This problem is close to copying a graph. For that as you said, just
do DFS or BFS and maintain a map from original nodes to copies. Use
the copy to set pointers whenever it exists. When it doesn't exist,
make a new node and add it to the map.
You can implement the map in various ways. A hash t
@ ALL
finding square matrix is quite a standard question and nw an easy one as
everyone knows the reccussence atul has given.
but i wanted to find max rectangle..
i know there is a DP for it. in O(n^2). for nxn matrix..don't know the
whole approach .but here is what i remember..
1. aproach i
wats d logic behind this???
On Tue, Mar 13, 2012 at 11:59 AM, atul anand wrote:
> here is the recurrence for solving this
>
> R[i, j] = (M[i,j] == 0 ? 0 : 1 + min( R[i-1, j], R[i-1, j-1], R[i,,j-1] )
> );
>
> On Tue, Mar 13, 2012 at 11:48 AM, rahul sharma wrote:
>
>>
>> April 4, 2010
>>
>> Given
interview-str...@googlegroups.com,
On Tue, Mar 13, 2012 at 8:34 AM, Supraja Jayakumar wrote:
> Hi
>
> Yes I will do that. I posted it to interview-str...@googlegroups.com. I
> do not find this group's id right. Pls tell me the id to which I have to
> subscribe.
>
> Thanks
>
>
> On Mon, Mar 12, 2
http://www.geeksforgeeks.org/archives/1155
On Tue, Mar 13, 2012 at 11:31 AM, Umer Farooq wrote:
> Yes that is exactly what they wanted. I proposed BFS for this solution.
> Anyway, there was another problem that I was able to solve; but the
> interviewer brought up a much more efficient approach.
Could anyone please tell me if Suffix Trees would be appropriate here
to use? or kindly suggest me a better data structure.
On 3/13/12, reynald reni wrote:
> Chunyuan, can this complexity be still reduced with any other data
> structure?
>
> On 3/13/12, Chunyuan Ge wrote:
>> it's a classic probl
Chunyuan, can this complexity be still reduced with any other data structure?
On 3/13/12, Chunyuan Ge wrote:
> it's a classic problem like Time = O(n*n), space = O(n)
>
> On Tue, Mar 13, 2012 at 12:55 PM, InThirstOfWisdom.rr <
> reni.reyn...@gmail.com> wrote:
>
>> Algorithm to find the longest co
Yes that is exactly what they wanted. I proposed BFS for this solution.
Anyway, there was another problem that I was able to solve; but the
interviewer brought up a much more efficient approach.
The problem was:
- Given a linked a linked list with one pointer pointing to next,
another poin
Yes that is exactly what they wanted. I proposed BFS for this solution.
Anyway, there was another problem that I was able to solve; but the
interviewer brought up a much more efficient approach.
The problem was:
Given a linked l
On Mon, Mar 12, 2012 at 11:31 PM, Gene wrote:
> Since there is no
16 matches
Mail list logo