[algogeeks] Finding max for all positions of a moving window

2010-09-17 Thread Tech Id
You have an array of 100 integers. There is a window of 10 elements which starts from 0th element and moves by 1 element till the 90th element. We need to print the maximum element for all the positions of the window. Hint: For the first position of the window, you have to find the maximum as

[algogeeks] Re: Google Interview Question

2010-09-17 Thread vikas kumar
nice recurrence On Sep 14, 9:29 pm, Gene gene.ress...@gmail.com wrote: You can approach this the same way you'd do it by hand.  Build up the string of brackets left to right.  For each position, you have a decision of either ( or ) bracket except for two constraints: (1) if you've

[algogeeks] Re: Yahoo Question

2010-09-17 Thread vikas kumar
@Bittu I am confused about one point you need to process atleast n*k elements so how will you do it in nlogk time. It seems really tricky if possible.it's min time should be O(nk). correct me if I am wrong. On Sep 17, 6:34 am, tkcn tkcna...@gmail.com wrote: Use k-way merging +1. 1.

[algogeeks] Re: Amazon Question

2010-09-17 Thread vikas kumar
struct list { median -- median from the start to num number ---number list *next }; during insertion : insert in sorted LL after that all subseq node's median has to be modified O(n) during median_retriev check the median value and return that O(1) I assumed deletion is not happening.

[algogeeks] Re: Drawing a graph

2010-09-17 Thread vikas kumar
use opengl library to draw the graph or whatever. take RED BOOK for reference. On Sep 14, 5:54 pm, Mithun avmit...@gmail.com wrote: Can anyone help me with the code for drawing a graph in C or CPP (using graphics) Input is an Adjacency matrix -- You received this message because you are

[algogeeks] Re: Google Interview Question-Snake and Ladder Design

2010-09-17 Thread vikas kumar
take this approach fill array of snakes starting position in snake[num_snake] for each snake[i] , take the end of snake and fill in some other array take random number gen and fill these arrays-- e.g. end_snake[i] = ran(start_snake[i]-10) // so that snake does not end up in same row same logic

Re: [algogeeks] Finding max for all positions of a moving window

2010-09-17 Thread Navin Naidu
Use Max-Heap, add first ten elements, the root element will be max, Next Iteration, remove a[0] and add a[10], max-heapify. On Fri, Sep 17, 2010 at 1:48 PM, Tech Id tech.login@gmail.com wrote: You have an array of 100 integers. There is a window of 10 elements which starts from 0th

[algogeeks] Re: Drawing a graph

2010-09-17 Thread robosonia
How about using graphviz? http://www.graphviz.org/Resources.php On 14 сен, 14:54, Mithun avmit...@gmail.com wrote: Can anyone help me with the code for drawing a graph in C or CPP (using graphics) Input is an Adjacency matrix -- You received this message because you are subscribed to the

[algogeeks] Re: Google Interview Question

2010-09-17 Thread Krunal Modi
Your solutions are pretty impressive. Which place(country) are you from ? where are you studying (or done :) ) ? Keep it up... Good Wishes.. --Krunal On Sep 14, 9:29 pm, Gene gene.ress...@gmail.com wrote: You can approach this the same way you'd do it by hand.  Build up the string of brackets

Re: [algogeeks] Re: Drawing a graph

2010-09-17 Thread Ashim Kapoor
what is this red book ?full name please? On Fri, Sep 17, 2010 at 1:01 PM, vikas kumar vikas.kumar...@gmail.comwrote: use opengl library to draw the graph or whatever. take RED BOOK for reference. On Sep 14, 5:54 pm, Mithun avmit...@gmail.com wrote: Can anyone help me with the code for

Re: [algogeeks] Re: Yahoo Question

2010-09-17 Thread umesh kewat
Create binary search tree using n nodes of K list den do in-order and make a single list On Fri, Sep 17, 2010 at 12:58 PM, vikas kumar vikas.kumar...@gmail.comwrote: @Bittu I am confused about one point you need to process atleast n*k elements so how will you do it in nlogk time.

[algogeeks] Yahoo!!!! Question Orkut.....tough One

2010-09-17 Thread bittu
if you click on any orkut member's name you will notice the relationship graph for both of you indicating through whom you are interconnected or in certain cases you won't get this path. if you have to propose algorithm what would be the one ... breadth first or depth first traversal with some

Re: [algogeeks] Yahoo!!!! Question Orkut.....tough One

2010-09-17 Thread saurabh singh
u need to find out the subset of connections associated with ur profile and that person's profile. using hashtable the problem will be solved.. On Sat, Sep 18, 2010 at 2:44 AM, bittu shashank7andr...@gmail.com wrote: if you click on any orkut member's name you will notice the relationship

[algogeeks] print largest continue subsequent in int array

2010-09-17 Thread Raj Jagvanshi
a[] = {4,1,2,3,4,5,40,41,19,20}; print = 40 , 41 sum = 81; give me code -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Re: Yahoo Question

2010-09-17 Thread Nikhil Jindal
@vikas: Total number of elements are not n*k. Total number of elements are n, which are divided into k lists. @Rahul Singal: +1 for ur answer. On Fri, Sep 17, 2010 at 12:58 PM, vikas kumar vikas.kumar...@gmail.comwrote: @Bittu I am confused about one point you need to process atleast n*k

Re: [algogeeks] Re: Amazon Question

2010-09-17 Thread Nikhil Jindal
Keep an augmented balanced BST. Augmented data: number of elements in the right and left subtrees . Insertion: logn Find Median: logn Cheers Nikhil Jindal Delhi College of Engineering On Fri, Sep 17, 2010 at 12:09 PM, vikas kumar vikas.kumar...@gmail.comwrote: struct list { median --

Re: [algogeeks] Re: Google Interview Question-Snake and Ladder Design

2010-09-17 Thread Anil Kumar S. R.
@bittu, we are here to discuss the way to solve it. Posting a code here will not do anything good. Anil Kumar S. R. http://sranil.googlepages.com/ The best way to succeed in this world is to act on the advice you give to others. On 14 September 2010 13:33, bittu shashank7andr...@gmail.com