[algogeeks] Partition of flow graph

2010-09-28 Thread yako...@gmail.com
Hello For the data flow graph G= (V,E),I have to determine a partition - in such a way that sub graphs created could be computed in parallel and the sub graphs are approximately of the same size (sqrt(|V|)) For example as in graph attached ( http://i55.tinypic.com/35lvu6x.png - the graph should be

[algogeeks] Partition of flow graph

2010-09-28 Thread yako...@gmail.com
Hello For the data flow graph G= (V,E),I have to determine a partition - in such a way that sub graphs created could be computed in parallel and the sub graphs are approximately of the same size (sqrt(|V|)) For example as in graph attached ( http://i55.tinypic.com/35lvu6x.png - the graph should be

Re: [algogeeks] search a 2d sorted array in less than O(n)

2010-09-28 Thread Rohit Saraf
Trivial algorithm : (Assuming it is in ascending order in both columns and rows) logarithmic time in max(n,m) Divide the 2-d table to 4 parts, the -right-bottom-most and the left-bottom-most are the smallest and largest values in the subtable. It should be clear that atleast two subtables can be

[algogeeks] Re: Partition of flow graph

2010-09-28 Thread Chi
http://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/ On Sep 28, 2:52 pm, yako...@gmail.com yako...@gmail.com wrote: Hello For the data flow graph G= (V,E),I have to determine a partition - in such a way that sub graphs created could be computed in parallel and the sub graphs are

Re: [algogeeks] Re: arrays

2010-09-28 Thread Nishant Agarwal
#includestdio.h #includestdlib.h int main() { int a[20],i,n,max,t,j,k; printf(Enter the no. of elements\n); scanf(%d,n); for(i=0;in;i++) scanf(%d,a[i]); for(i=0;in-1;i++) { j=n-1; max=0; k=i; while(ij) {

Re: [algogeeks] Re: BST in BT

2010-09-28 Thread TurksHead Education
Maximum Sized Binary Search Tree in a Binary Tree: http://www.rawkam.com/?p=822 On Mon, Sep 27, 2010 at 10:34 AM, Chonku cho...@gmail.com wrote: @Prodigy As per your example, 8 15 20 25 which is the is indeed the maximum binary search tree in this binary tree is only a solution to smaller

[algogeeks] Re: do this: two numbers with min diff

2010-09-28 Thread sourav
Hi Friends This is an interesting problem and request you all to give a brief intro to your code before putting the code. Or you may just mention the under lying concept in the code. This will be of great help and others will find it more ready to improve by adding there approach. Coming back to

[algogeeks] Re: ALgo help pls

2010-09-28 Thread sourav
In my opinion also, this is a Majority vote algorithm as mentioned by Navin and as coded by Dave. Only point I would add to @Dave's code is that it wont be possible to find if the majority element has 2n/3 occurance as majority element keeps changing during the run and as the majority algorithm

Re: [algogeeks] Re: power set

2010-09-28 Thread TurksHead Education
Power set : http://www.rawkam.com/?p=330 On Sun, Sep 19, 2010 at 2:45 AM, Gene gene.ress...@gmail.com wrote: The power set of a set with N elements has size O(2^N). You can't do anything with it in polynomial time. On Sep 18, 5:03 pm, bittu shashank7andr...@gmail.com wrote: can we solve

Re: [algogeeks] finding largest and second largest elements

2010-09-28 Thread TurksHead Education
see a nice solution and related puzzle at http://www.rawkam.com/?p=1034 On Tue, Sep 28, 2010 at 6:31 AM, sharad kumar aryansmit3...@gmail.comwrote: hey isn't it suppposed to be tournament problem.. On Fri, Sep 24, 2010 at 12:06 AM, Divesh Dixit dixit.coolfrog.div...@gmail.com wrote:

Re: [algogeeks] Re: Amazon Interview

2010-09-28 Thread umesh kewat
still there is some problem related to numbers encoding like.. 22333101 here how will u going to encode it??? On Tue, Sep 28, 2010 at 1:38 AM, ligerdave david.c...@gmail.com wrote: it's a compression problem. using hex instead of oct saves more space

[algogeeks] find out the mid point of a single linked list

2010-09-28 Thread Divesh Dixit
Given a singly-linked, find out (just give the basic logic) the mid point of a single linked list in a single parse of the list. Assume the program would be loaded in read-only memory so no manipulation of the list is allowed. -- You received this message because you are subscribed to the Google

Re: [algogeeks] Re: do this: two numbers with min diff

2010-09-28 Thread coolfrog$
@ sorurav yes , the basic logic is required so that the code can be understood in single Run.. i also request the same to all dear friends. Regards.. On Tue, Sep 28, 2010 at 8:11 PM, sourav souravs...@gmail.com wrote: Hi Friends This is an interesting problem and request you all

[algogeeks] Algorithm to determine the largest number of envelopes that can be nested inside one another.

2010-09-28 Thread Divesh Dixit
You are given an unlimited number of each of n different types of envelopes. The dimensions of envelope type i are xi × yi.(i is in sub script) In nesting envelopes inside one another, you can place envelope A inside envelope B if and only if the dimensions A are strictly smaller than the

[algogeeks] Re: Amazon Interview

2010-09-28 Thread ligerdave
that will be 12 23 34 1 0 1c1 what's the some related problem? only last char in the group represent the char, leading chars represent the number of the repeated char. space(or whatever you like it to be) is the separator of groups. when you see space, replace w/ '\t'. On Sep 28, 2:58 am,

Re: [algogeeks] Algorithm to determine the largest number of envelopes that can be nested inside one another.

2010-09-28 Thread Rahul Singal
A possible solution i can think is create a directed graph where each vertex is a envelope and edges are from a bigger envelope to smaller envelope ( one which can fit in bigger envelope ) . Now the problem is reduce to finding longest path in the graph . Regards Rahul -- You received this

[algogeeks] Re: Finding hash collisions without storage

2010-09-28 Thread haki
Can u elaborate more? On Sep 28, 5:41 am, saurabh singh saurabh.n...@gmail.com wrote: u can use log(n)+1 space to do that by using bit string On Mon, Sep 27, 2010 at 10:37 PM, AdrianW atw...@gmail.com wrote: Suppose you have N strings that can be generated on-the-fly, and you wanted to

[algogeeks] Re: do this: two numbers with min diff

2010-09-28 Thread Ashu
May be this helps http://ds-gyan.blogspot.com/2009/12/two-numbers-with-minimum-difference.html On Sep 28, 10:28 am, coolfrog$ dixit.coolfrog.div...@gmail.com wrote: @ sorurav     yes , the basic logic is required so that the code can be understood in single Run..     i also request the same

[algogeeks] please explain the pointer math on page 22 of this pdf

2010-09-28 Thread rahul rai
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-087-practical-programming-in-c-january-iap-2010/lecture-notes/MIT6_087IAP10_lec05.pdf Thanking In Advance -- Rahul K Rai And The Geek Shall Inherit The Earth -- You received this message because you are subscribed to the

Re: [algogeeks] Algorithm to determine the largest number of envelopes that can be nested inside one another.

2010-09-28 Thread Prashant Kulkarni
i think it is similar to finding max in a list O(n) or sorting algorithm O(n log n) -- Prashant Kulkarni On Tue, Sep 28, 2010 at 11:33 PM, Rahul Singal rahulsinga...@gmail.comwrote: A possible solution i can think is create a directed graph where each vertex is a envelope and edges are

Re: [algogeeks] find out the mid point of a single linked list

2010-09-28 Thread Prashant Kulkarni
maintain two pointer 1) slow pointer : it will point to next node for each iteration (ie node=node-next) 2) fast pointer : it will point to two ahead node for each iteration ( ie node=node-next-next) when fast pointer reaches the end of linked list (NULL), slow pionter will point to middle of

[algogeeks] Re: please explain the pointer math on page 22 of this pdf

2010-09-28 Thread karora
Hi Rahul, All it is saying is that you can do simple arithmetic on pointers directly which modified the address it is pointing to. Suppose you have an array of int type (int arr[10];)then you can access elements of the array in following ways: 1. arr[1], arr[4] etc. 2. arr+1, arr+4 etc. as arr is