Re: [algogeeks] Re: Directi Campus Internship paper

2012-10-24 Thread bharat b
LRU implementation : -Maintain a double linked list which stores LRU items(say 50). -Keep one head and tail pointers of the linked list. -Maintain a hash table which has value of the linked list as key and memory location of that node as value. - When ever hash table doesn't conta

[algogeeks] Re: Directi Campus Internship paper

2012-10-24 Thread Dave
@Ujjwal: Here's an algorithm for problem 2: Given a number n, form the prime number factorization of n: n = p1^k1 * p2^k2 * ... * pm^km, where the pi are distinct primes and ^ represents exponentiation. If any ki = 1, terminate the factorization and report that n is not a Trojan number. T

[algogeeks] Re: directi paper pattern

2012-08-02 Thread piyush dureja
plz mail it to me too... piyushdur...@gmail.com On Tuesday, July 31, 2012 7:37:03 PM UTC+5:30, deepikaanand wrote: > > can anyone tell me the pattern (selection procedure )followed by directi > this year -- You received this message because you are subscribed to the Google Groups "Algorithm G

Re: [algogeeks] Re: Directi Written Q 2012

2012-07-31 Thread SHOBHIT GUPTA
sory fr prev wrng cmnt On Mon, Jul 30, 2012 at 4:04 PM, SHOBHIT GUPTA wrote: > wat abt 32 > > > On Mon, Jul 30, 2012 at 4:02 PM, Lucifer wrote: > >> @ ruru >> I think we can do it in log(n).. >> I am not jolting down the code but giving out the idea that would lead >> to log(n) time.. >> >> If w

Re: [algogeeks] Re: Directi Written Q 2012

2012-07-31 Thread SHOBHIT GUPTA
wat abt 32 On Mon, Jul 30, 2012 at 4:02 PM, Lucifer wrote: > @ ruru > I think we can do it in log(n).. > I am not jolting down the code but giving out the idea that would lead > to log(n) time.. > > If we write down all the nos. in the binary format one below the > other.. we will observe the fo

[algogeeks] Re: Directi Interview Ques

2012-07-30 Thread Lucifer
@vivek.. u can't sort.. its a stable merge... The question is to stably merge the two arrays..the stable merge of the 2 arrays can take place in (2n C n) ways.. 1 of these arrangements will lead to the maximum sum.. We are required to find that sequence/maxsum.. A stable merge in this case is not

Re: [algogeeks] Re: Directi Interview Ques

2012-07-30 Thread vivek veldandi
On Mon, Jul 30, 2012 at 3:56 PM, Lucifer wrote: > @small correction: > In the initialization condition the loop index i shall start from 2 > and not 0.. > // for(int i =2; i <=n; i+=2) > > > On 30 July, 15:23, Lucifer wrote: > > @Prakhar Jain > > > > I believe that the following recurrence shall

[algogeeks] Re: Directi Written Q 2012

2012-07-30 Thread Lucifer
@ ruru I think we can do it in log(n).. I am not jolting down the code but giving out the idea that would lead to log(n) time.. If we write down all the nos. in the binary format one below the other.. we will observe the following pattern :- at bit index '1' the bit value toggles in group of '01'

[algogeeks] Re: Directi Interview Ques

2012-07-30 Thread Lucifer
@small correction: In the initialization condition the loop index i shall start from 2 and not 0.. // for(int i =2; i <=n; i+=2) On 30 July, 15:23, Lucifer wrote: > @Prakhar Jain > > I believe that the following recurrence shall solve it.. > > Take an array  C[n+1][n+1]... > > Now, we only need

[algogeeks] Re: Directi Written Q 2012

2012-07-30 Thread Zyro
int func(int start,int end) { int count=0; for(int i=start;i<=end;i++) { int tmp=i; while(tmp!=0) { tmp=tmp&(tmp-1); count++; } } return count; } Worst Case complexity : O((b-a)*32) Please let me know if there is another gud way to d

[algogeeks] Re: Directi Interview Ques

2012-07-30 Thread Lucifer
@Prakhar Jain I believe that the following recurrence shall solve it.. Take an array C[n+1][n+1]... Now, we only need to calculate those C[i][j]'s where i+j is even.. // Assuming 1-based index... Initialization condition... C[0][0]=0; for(int i =0; i <=n; i+=2) { C[0][i] = C[0][i-2] + B[i

[algogeeks] Re: Directi Written Q 2012

2012-07-26 Thread ruru
Yes Manish, but how did you get to the answer? On Jul 24, 10:00 pm, manish untwal wrote: > I think the question is in the written round!!! > > > > > > > > > > On Tue, Jul 24, 2012 at 9:11 PM, algo bard wrote: > > #include > > #define RANGE_START 0 > > #define RANGE_END 100 > > > int main() > > {

Re: [algogeeks] Re: Directi Written Q 2012

2012-07-24 Thread Lomash Goyal
@dave sir-your algorithm is having a complexity of n(2) but the solution that i have given is of log(n) i guess. On Tue, Jul 24, 2012 at 8:10 PM, Dave wrote: > @Ruru: > > int i,j,sum=100*101/2; > for( i = 1 ; i <= 100 ; ++i ) > { > j = i; > while( j ) > { > j >> = 1; >

[algogeeks] Re: Directi Written Q 2012

2012-07-24 Thread Dave
@Ruru: int i,j,sum=100*101/2; for( i = 1 ; i <= 100 ; ++i ) { j = i; while( j ) { j >> = 1; sum -= j } } printf("%i\n",sum); Dave On Tuesday, July 24, 2012 4:39:42 AM UTC-5, ruru wrote: > find no. of 1's in binary format of numbers from 1 to 100. like for > 1

[algogeeks] Re: Directi Written Q 2012

2012-07-24 Thread lomash goyal
//the following functions will count number of bits in the number int countbits(int n) { int count=0; while(n) { n/=2; count++; } return count; } int countnumberof1(int number) { if(number==0) return 0; if(number==1) return 1; if(number==2) return 2; if(number==3) return 4;

[algogeeks] Re: Directi Interview Ques

2012-07-23 Thread Rahul Kumar
> > > http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi?board=riddles_cs;action=display;num=1280183627 > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/alg

Re: [algogeeks] Re: Directi Interview Ques

2012-07-21 Thread a g
@ anshu - should it not be like this : f( x(i, n), y(j, n) ,0) = max( { x[i] * x[i+1] + max ( f( x(i+2, n), y(j, n), 0) , f( x(i+2, n), y(j, n), 1) ) }, { x[i] * y[j] + max ( f( x(i+1, n), y(j+1, n), 1 ), f( x(i+1, n), y(j +1, n), 0 ) } ); On Mon, Jul 16, 2012 at 2:15 AM, Anshu Mishra wrot

Re: [algogeeks] Re: Directi Interview Ques

2012-07-17 Thread Amit Jain
Please see *stable merge *in question. On Sun, Jul 15, 2012 at 2:04 AM, sengar.mahi wrote: > @naveen : 3*7+2*9+1*3 =42 is not maximum.. > sum of the product would me maximum wen, i guess, most weighted elements > are adjacent > like in this case > if c={1,2,3,3,7,9} > 1*2 + 3*3 + 7*9=74 (maximum

Re: [algogeeks] Re: Directi Interview Ques

2012-07-17 Thread Amit Jain
Awesomely done :) +1 On Mon, Jul 16, 2012 at 2:15 AM, Anshu Mishra wrote: > two arrays are suppose x[n], y[n]; > > take a function > f( x(i, n), y(j, n) , 0) --> taking x[i] as a first element of merged > array then max sum; > f( x(i, n), y(j, n), 1) --> taking y[j] as a first element of > merge

Re: [algogeeks] Re: Directi Interview Ques

2012-07-15 Thread Anshu Mishra
two arrays are suppose x[n], y[n]; take a function f( x(i, n), y(j, n) , 0) --> taking x[i] as a first element of merged array then max sum; f( x(i, n), y(j, n), 1) --> taking y[j] as a first element of merged array then max sum; f( x(i, n), y(j, n) ,0) = max( { x[i] * x[i+1] + f( x(i+1, n),

Re: [algogeeks] Re: Directi Interview Ques

2012-07-14 Thread Arunachala Karthik
O(n2) Time and O(n2) space solution - 1. Total of (n2 + 2n - 2) products possible with given combinations - (n - 1) times (n + 1) and once n for the first array for the last element; total of (n -1) products for 2nd array -therefore (n -1)(n +1) + n + (n-1) = n2 + 2n - 2. Products to be classifie

Re: [algogeeks] Re: Directi Interview Ques

2012-07-14 Thread sengar.mahi
@naveen : 3*7+2*9+1*3 =42 is not maximum.. sum of the product would me maximum wen, i guess, most weighted elements are adjacent like in this case if c={1,2,3,3,7,9} 1*2 + 3*3 + 7*9=74 (maximum ) thus this question is just merging both strings such resultant (here C) is in sorted order which can b

[algogeeks] Re: Directi Interview Ques

2012-07-14 Thread Navin Gupta
As the final array contains element in stable-order, at any time we have 3 options for choosing the elements from A & B. 1- A[i] & A[i+1] 2- A[i] & B[I] 3- B[i] & B[i+1] we will choose that pair whose product is maximum. For ex:- A-2,1,3 B-3,7,9 C- 3,7,2,9,1,3 Its a linear time solution with cons

Re: [algogeeks] Re: Directi question

2012-07-10 Thread algo bard
int no_of_steps[arr_length] = {MAX}; if ( (arr_length==0) || (arr[0] == 0) ) //if there are no elements or the very first element is 0 -> we can't jump anywhere return MAX; no_of_steps[0] = 0; //no jumps required to jump from element 0 to itself. for (int i=1; i= (i - j) )//if it is po

Re: [algogeeks] Re: Directi question

2012-07-10 Thread algo bard
^ cout<< no_of_steps[arr_length -1]; On Mon, Jul 9, 2012 at 8:44 PM, algo bard wrote: > int no_of_steps[arr_length] = {MAX}; > > if ( (arr_length==0) || (arr[0] == 0) ) //if there are no elements > or the very first element is 0 -> we can't jump anywhere > return MAX; > > no_of_steps[0] =

[algogeeks] Re: Directi question

2012-07-09 Thread Mr.B
There is a greedy solution discussion about this approach. I don't have a formal proof for this. Any counter example will be helpful. at every place 'k' .. do the following. --> find max ( a[k+i]+i ) where 1 <= i <= a[i] for the given example: A = {4 0 0 3 6 5 4 7 1 0 1 2} initially a 4, the

Re: [algogeeks] Re: Directi question-centre of the tree

2012-06-21 Thread sanjay pandey
@ashish it wont be...first we r finding one end from any node dat is "r" n den frm dat end we r traversing to other deepest end... it is possible dat r b d intermediate node...n distance from r to v2 is smaller than from r to v1 -- You received this message because you are subscribed to the Googl

Re: [algogeeks] Re: Directi question-centre of the tree

2012-06-20 Thread Ashish Goel
farthest from 2: Find a vertex v1 | the farthest form r. 3: Find a vertex v2 | the farthest form v1. won't v2 be farthest from r? or we are talking about alternate pats also Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652 On Wed, Jun 20, 2012

Re: [algogeeks] Re: Directi question-centre of the tree

2012-06-20 Thread adarsh kumar
As you traverse along and find the diameter of the tree, keep track of the number of nodes thereby traversed. Let that be equal to n. Now, centre is the node corresponding to floor((n+1)/2). On Wed, Jun 20, 2012 at 5:19 PM, Nishant Pandey < nishant.bits.me...@gmail.com> wrote: > I am asking again

Re: [algogeeks] Re: Directi question-centre of the tree

2012-06-20 Thread Nishant Pandey
I am asking again .. can any one please suggest better method for getting the median on the longest path of the tree .. efficient method . On Tue, Jun 19, 2012 at 5:08 PM, Nishant Pandey < nishant.bits.me...@gmail.com> wrote: > > for getting diameter we can simply add the max height of left subtr

Re: [algogeeks] Re: Directi question-centre of the tree

2012-06-19 Thread Nishant Pandey
for getting diameter we can simply add the max height of left subtree and max height of the right sub tree . the main issue is how efficiently we find median on that longest path to get the center of the tree . can any bdy sugest optimized algo for that ? On Mon, Jun 18, 2012 at 6:08 PM, rajesh p

Re: [algogeeks] Re: Directi question-centre of the tree

2012-06-18 Thread rajesh pandey
I found it in some paper ;) Diameter and center De nition 4. The diameter of tree is the length of the longest path. De nition 5. A center is a vertex v such that the longest path from v to a leaf is minimal over all vertices in the tree.Tree center(s) can be found using simple algorithm. Algor

Re: [algogeeks] Re: Directi question-centre of the tree

2012-06-16 Thread achala sharma
I think this algorithm is used for calculating poset in graph. On Sat, Jun 16, 2012 at 3:04 AM, Hemesh Singh wrote: > + 1 for DK's solution. Is that a standard algorithm coz I feel like I have > heard it somewhere ?? > > > On Mon, Aug 8, 2011 at 1:37 AM, DK wrote: > >> @KK: DFS and BFS are O(N)

[algogeeks] Re: Directi Question

2012-06-15 Thread algogeek
@maddy: The students should be assigned consecutive books only. That is, u CANNOT assign book 1, 2 and 5 to a single student. either assign book 1, 2 and 3 or 1 and 2 or any such combination of consecutive numbers. On Thursday, June 14, 2012 12:26:09 PM UTC+5:30, algogeek wrote: > > In a li

[algogeeks] Re: Directi Question

2012-06-15 Thread shiv narayan
On Jun 16, 2:1@shubham couldnt understand following logic in you algo please explain "when first k elemnts traversed then traverse again k elemnts of B and S[2*k-i]+=B[i])...again S[i-2*k]+=B[i][.so on till B is traversed completely." 6 am, Shubham Sandeep wrote: > wat constraints does dis bri

Re: [algogeeks] Re: Directi question-centre of the tree

2012-06-15 Thread Hemesh Singh
+ 1 for DK's solution. Is that a standard algorithm coz I feel like I have heard it somewhere ?? On Mon, Aug 8, 2011 at 1:37 AM, DK wrote: > @KK: DFS and BFS are O(N) and Floyd Warshall is O(N^3). > Could you please state how you can use the traversals directly to get the > center? (And prove yo

Re: [algogeeks] Re: [Directi] Two most distant element in tree

2012-03-26 Thread atul anand
@Don : it seem that you are calculating diameter of a tree ?? On Mon, Mar 26, 2012 at 7:18 PM, Don wrote: > If the longest path passes through the root of the tree, then the > length of the path is the depth of the left subtree plus the depth of > the right subtree. If the longest path does not

Re: [algogeeks] Re: [Directi] Two most distant element in tree

2012-03-26 Thread shady
@arunachalam you have misunderstood the problem. On Tue, Mar 27, 2012 at 8:10 AM, Arunachalam wrote: > This algorithm is almost right, but not exactly correct. > > Say for example you have a binary tree like this > >1 > 2 >3 4 > 5 6 > > The

Re: [algogeeks] Re: [Directi] Two most distant element in tree

2012-03-26 Thread Arunachalam
This algorithm is almost right, but not exactly correct. Say for example you have a binary tree like this 1 2 3 4 5 6 The length of the longest path is 4, and this algorithm would return 5. The algorithm can be slightly modified to find the m

[algogeeks] Re: [Directi] Two most distant element in tree

2012-03-26 Thread Don
If the longest path passes through the root of the tree, then the length of the path is the depth of the left subtree plus the depth of the right subtree. If the longest path does not pass through the root, then it is the max of the longest path in the left subtree or the right subtree. int longes

[algogeeks] Re: [Directi] Two most distant element in tree

2012-03-25 Thread Lucifer
I think we can tweak the standard "find the height of the tree" program to get the result.. As we know that the 2 extremes of the longest path are nothing but leaves. Hence, all we need to do is figure out is for which set of leaves would the path be maximum.. [ Special Case : it need to be always

Re: [algogeeks] Re: Directi Questions - needed answers

2011-10-28 Thread Kunal Shridhar
@Mohit Agreed. The answer is O(n). On Fri, Oct 28, 2011 at 6:48 PM, mohit verma wrote: > @ankur - Ans-9 how can it be log n. The heap given is Max heap. I think > it should be O(n) using array or tree traversal (as heap is implemented) > keeping current min at hand. Correct me if m wrong. > >

Re: [algogeeks] Re: Directi Questions - needed answers

2011-10-28 Thread mohit verma
@ankur - Ans-9 how can it be log n. The heap given is Max heap. I think it should be O(n) using array or tree traversal (as heap is implemented) keeping current min at hand. Correct me if m wrong. On Sat, Oct 15, 2011 at 12:14 PM, shady wrote: > already been answered... :-/ > but have to say

Re: [algogeeks] Re: Directi Questions - needed answers

2011-10-14 Thread shady
already been answered... :-/ but have to say you are damn quick... On Sat, Oct 15, 2011 at 12:03 PM, Bittu Sarkar wrote: > Q7. Correct answer is 12km west and 12km south for sure!! > > > On 21 September 2011 13:28, Nitin Garg wrote: > >> Ohh i totally missed that line. >> Thanx a lot :) >> >> >

Re: [algogeeks] Re: Directi Questions - needed answers

2011-10-14 Thread Bittu Sarkar
Q7. Correct answer is 12km west and 12km south for sure!! On 21 September 2011 13:28, Nitin Garg wrote: > Ohh i totally missed that line. > Thanx a lot :) > > > On Wed, Sep 21, 2011 at 10:46 AM, pankaj agarwal < > agarwal.pankaj.1...@gmail.com> wrote: > >> @Nitin Garg >> >> Question 6 - >> >> i

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-21 Thread Nitin Garg
Ohh i totally missed that line. Thanx a lot :) On Wed, Sep 21, 2011 at 10:46 AM, pankaj agarwal < agarwal.pankaj.1...@gmail.com> wrote: > @Nitin Garg > > Question 6 - > > i agree that greater the sum is and greater the probability to getting it. > but in given question if sum>100 then rolling is

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-20 Thread pankaj agarwal
@Nitin Garg Question 6 - i agree that greater the sum is and greater the probability to getting it. but in given question if sum>100 then rolling is stopped so for P(106)=P(100)*1/6 P(105)=P(100)*1/6+P(99)*1/6 . . . P(101)=P(100)*1/6+P(99)*(1/6)+P(98)*(1/6)+P(97)*(1/6)+..+P(95)*(1/6) now P(101)

[algogeeks] Re: Directi Questions - needed answers

2011-09-20 Thread asdqwe
Ans 7: Why am I getting such an answer!! [co-ordinates] next_step_size [-2, -2] 5 [-4, -4] 9 [-6, -6] 13 [-8, -8] 17 [-10, -10] 21 [-12, -12] 25 [-14, -14] 29 [-16, -16] 33 [-18, -18] 37 [-20, -20] 41 [-22, -22] 45 [-24, -24] 49 [-26, -26] 53 [-28, -28] 57 [-30, -30] 61 [-32, -32] 65 [-34, -34] 69

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Ankur Garg
Q9 - > 1 *logn for getting the minimum element ..Normal heap Sort procedure Q3 - > n+logn-2 comparisions so 51 -2 + log 51 Regards Ankur On Mon, Sep 19, 2011 at 7:59 PM, Ashima . wrote: > m getting result in 95 matches > > Ashima > M.Sc.(Tech)Information Systems > 4th year > BITS Pilani > R

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Ashima .
m getting result in 95 matches Ashima M.Sc.(Tech)Information Systems 4th year BITS Pilani Rajasthan On Mon, Sep 19, 2011 at 7:07 PM, malay chakrabarti wrote: > i have explained :) > > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . wrote: > >> @malay: how cm n+logn-2? >> cn u explain the logic ?

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread malay chakrabarti
i have explained :) On Sun, Sep 18, 2011 at 11:53 PM, Ashima . wrote: > @malay: how cm n+logn-2? > cn u explain the logic ? > > Ashima > M.Sc.(Tech)Information Systems > 4th year > BITS Pilani > Rajasthan > > > > > On Sun, Sep 18, 2011 at 11:07 AM, Ashima . wrote: > >> rite! 62.5% >> >> Ashima

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread praveen raj
For question 5 reentrant On 19-Sep-2011 1:43 PM, "Nitin Garg" wrote: > Can someone tell answers to question 2 and 5 with explanation?? > > > > > On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg wrote: > >> In Question 4 i just kept counting new processes that are being added in >> every iteration

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread praveen raj
Given in the question . On 19-Sep-2011 2:57 PM, "Bhanu Chowdary" wrote: > @Nithin: Sorry I did not understand your logic!! If a person looses a match > he should be knocked out of the tournament. Could you please explain why 2 > matches to knock out a person?? > > On Mon, Sep 19, 2011 at 2:47 PM,

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Bhanu Chowdary
@Nithin: Sorry I did not understand your logic!! If a person looses a match he should be knocked out of the tournament. Could you please explain why 2 matches to knock out a person?? On Mon, Sep 19, 2011 at 2:47 PM, praveen raj wrote: > For question 2 see ashima link. > > On 19-Sep-2011 1:43 PM,

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread praveen raj
For question 2 see ashima link. On 19-Sep-2011 1:43 PM, "Nitin Garg" wrote: > > Can someone tell answers to question 2 and 5 with explanation?? > > > > > On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg wrote: >> >> In Question 4 i just kept counting new processes that are being added in every iterati

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread sagar pareek
@VIHARRI i think q.5 is *Which is not thread safe ??* :D :D On Mon, Sep 19, 2011 at 1:43 PM, Nitin Garg wrote: > Can someone tell answers to question 2 and 5 with explanation?? > > > > > On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg wrote: > >> In Question 4 i just kept counting new processes that

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Nitin Garg
Can someone tell answers to question 2 and 5 with explanation?? On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg wrote: > In Question 4 i just kept counting new processes that are being added in > every iteration. > No. of new processes being created is equal to the already running no. of > even pi

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Nitin Garg
In Question 4 i just kept counting new processes that are being added in every iteration. No. of new processes being created is equal to the already running no. of even pid processes. Time - PId 0 - 0 1 1 - 0,12 2, - 0,1,23 3, -

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Nitin Garg
Question 6 - Intuitively you can see that the greater the sum is, the greater the favorable events in sample space. e.g. - sum = 1 .. cases {(1)} Pr = 1/6 sum = 2 cases {(2),(1,1)} Pr = 1/6 + 1/36 sum = 3cases {(3),(2,1)(1,2)(1,1,1)} Pr = 1/6 + 1/36 +1/36 + 1/216 for

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread Nitin Garg
Question 3 - To eliminate one player, you need to host atleast 2 matches and make him loose in both 2. These 2 matches can not contribute to elimination of any other player. So, min 2 matches for every player who is to be eliminated, hence 100. On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary wro

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-18 Thread Bhanu Chowdary
@Nitin: Answer to question 3 is 50. On Mon, Sep 19, 2011 at 11:44 AM, praveen raj wrote: > @nitin Plz explain how u have reached answer of question no. 4 and 6 > > On 19-Sep-2011 12:26 AM, "Nitin Garg" wrote: > > > > Answer 3 - 100 > > Answer 6 - 103 > > Answer 4 - 194 total processes includin

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-18 Thread praveen raj
@nitin Plz explain how u have reached answer of question no. 4 and 6 On 19-Sep-2011 12:26 AM, "Nitin Garg" wrote: > > Answer 3 - 100 > Answer 6 - 103 > Answer 4 - 194 total processes including the parent > Answer 7 - 12 km south, 12 km east > > > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . wrote:

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-18 Thread teja bala
@Nithin Garg how 194 for the 4 question? On Mon, Sep 19, 2011 at 12:26 AM, Nitin Garg wrote: > Answer 3 - 100 > Answer 6 - 103 > Answer 4 - 194 total processes including the parent > Answer 7 - 12 km south, 12 km east > > > On Sun, Sep 18, 2011 at 11:53 PM, Ashima . wrote: > >> @malay: how cm n

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-18 Thread Nitin Garg
Answer 3 - 100 Answer 6 - 103 Answer 4 - 194 total processes including the parent Answer 7 - 12 km south, 12 km east On Sun, Sep 18, 2011 at 11:53 PM, Ashima . wrote: > @malay: how cm n+logn-2? > cn u explain the logic ? > > Ashima > M.Sc.(Tech)Information Systems > 4th year > BITS Pilani > Raj

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-18 Thread Ashima .
@malay: how cm n+logn-2? cn u explain the logic ? Ashima M.Sc.(Tech)Information Systems 4th year BITS Pilani Rajasthan On Sun, Sep 18, 2011 at 11:07 AM, Ashima . wrote: > rite! 62.5% > > Ashima > M.Sc.(Tech)Information Systems > 4th year > BITS Pilani > Rajasthan > > > > > On Sat, Sep 17, 201

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-18 Thread Ashima .
rite! 62.5% Ashima M.Sc.(Tech)Information Systems 4th year BITS Pilani Rajasthan On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti wrote: > create a tournament tree.in each round one value is eliminated to obtain > in the process the winner or the highest value in n-1 comparisons. Then > chec

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-17 Thread malay chakrabarti
create a tournament tree.in each round one value is eliminated to obtain in the process the winner or the highest value in n-1 comparisons. Then check the queue of the winner which contains log(n) entries of the values beaten by the winner which implicitly will contain the runners up.Then log(n)-1

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-17 Thread Yogesh Yadav
Q3. 101 matches .. On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI wrote: > hey i'm also thinking n + logn -2.. but couldnt able to figure out > how??? can you please explain the logic > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To po

[algogeeks] Re: Directi Questions - needed answers

2011-09-17 Thread VIHARRI
hey i'm also thinking n + logn -2.. but couldnt able to figure out how??? can you please explain the logic -- 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 th

Re: [algogeeks] Re: Directi

2011-08-19 Thread NIKHIL JAIN
some more questions apart from them 1. area of the largest square such that it lies only on the black square of chess such that the side of the chess square is 2 cm. 2. there is a rectangle area such that in it m number of roads are moving from east to west and n number of roads are moving from no

[algogeeks] Re: Directi

2011-08-19 Thread Agyat
k thanxgot it On Aug 19, 9:07 pm, sagar pareek wrote: > search the archives ... > direct i's questions already discussed many times > > > > On Fri, Aug 19, 2011 at 9:33 PM, Agyat wrote: > > Hi, friends > > tom i m having directi written test followed by coding(ol) and written > > test is eli

Re: [algogeeks] Re: directi prepration

2011-08-09 Thread sagar pareek
In written test all the basics like apti(major), OS, networking(major), shell programming(major) were there i m not sure about C programming in written and in coding i too faced that same log ACCESS program...i was unable to fetch system's current time stamp but still my logic was correct so i w

Re: [algogeeks] Re: directi prepration

2011-08-09 Thread aditi garg
@Kunal: in the written test wer the ques technical or aptitude?? On Tue, Aug 9, 2011 at 4:42 PM, NIKHIL JAIN wrote: > thnx > > can you please tell some of the written questions so that i will have an > idea what kind of questions are being asked by them > > -- > You received this message because

Re: [algogeeks] Re: directi prepration

2011-08-09 Thread NIKHIL JAIN
thnx can you please tell some of the written questions so that i will have an idea what kind of questions are being asked by them -- 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

Re: [algogeeks] Re: directi prepration

2011-08-09 Thread Kunal Yadav
The procedure was like this:- First they had a written test of 45 questions of 90 mins. Depending on the performance in the test they divided selected students into two buckets. one for software dev and other for sys ops. Then there was coding round. For sys ops one has to extract some information

Re: [algogeeks] Re: directi prepration

2011-08-09 Thread NIKHIL JAIN
can any dce student give an idea whats the procedure and what are the questions asked by directi recruitment group -- 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

Re: [algogeeks] Re: Directi interview question

2011-08-08 Thread Brijesh Upadhyay
Yeah..right..! u have to select continuous 10 petrol pumps , so just traverse through every set of 10 pumps with complexity of o(n). e.g. (1,10) (2,11) (3,12)(91 ,100) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discu

Re: [algogeeks] Re: Directi interview question

2011-08-08 Thread Ankur Garg
I can think of this solution Put first elements in a max heap ..O(10) Now take 11 th element ..compare it with root of this max heap ..If less than root ignore ..else remove root and call max-heapify and put this element in right place Similarly do this for rest Complexity will be n+nlogk wher

Re: [algogeeks] Re: Directi interview question

2011-08-08 Thread shady
@DK can you please explain your solution, i couldn't understand... @all any alternate solution ? On Sun, Aug 7, 2011 at 11:02 PM, DK wrote: > This is a simple problem: > > 1. Understand that if you are selecting 2 petrol pumps, say P and Q with > say another petrol pump R between them, then it

[algogeeks] Re: Directi question-centre of the tree

2011-08-07 Thread DK
@KK: DFS and BFS are O(N) and Floyd Warshall is O(N^3). Could you please state how you can use the traversals directly to get the center? (And prove your correctness too?) The solution given by Wladimir (& expanded upon by me) is O(N) and uses (somewhat) the inverse of a BFS as a traversal. --

Re: [algogeeks] Re: Directi Question

2011-08-07 Thread Vipul Sharma
@kunal patil: U were proceeding in correct way...in next series u cud hav seen a formation of arithmatico geometric series... It doesnt matter what the value of no of faces in a dice is..ans will be always 2...:) My simplified soln: o+e+1 o=probability of odd number coming in 1 throw of dice I

[algogeeks] Re: Directi question-centre of the tree

2011-08-07 Thread KK
Codechef Ques(Initiative of Directi) use DFS, BFS or Floyd Warshall... :) -- 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 algogeek

Re: [algogeeks] Re: Directi interview question

2011-08-07 Thread DK
This is a simple problem: 1. Understand that if you are selecting 2 petrol pumps, say P and Q with say another petrol pump R between them, then it is optimal to include R into the set of selected petrol pumps as the max-distance for the chosen pumps remains PQ but number of included petrol pump

Re: [algogeeks] Re: Directi interview question

2011-08-07 Thread Anuj Kumar
starting from each petrol pump binary search for the value of distance On Sun, Aug 7, 2011 at 9:15 PM, subramania jeeva wrote: > No.. They are not uniform.. They will give you distance between two > adjacent stations.. > > > > > > > > Cheers > ~ Jeeva ~ > > > > On Sun, Aug 7, 2011 at 9:

Re: [algogeeks] Re: Directi interview question

2011-08-07 Thread subramania jeeva
No.. They are not uniform.. They will give you distance between two adjacent stations.. Cheers ~ Jeeva ~ On Sun, Aug 7, 2011 at 9:13 PM, iama wrote: > I think you are missing some part of the question > Are the petrol pumps placed uniformly? > How many do we have to select exac

[algogeeks] Re: Directi interview question

2011-08-07 Thread iama
I think you are missing some part of the question Are the petrol pumps placed uniformly? How many do we have to select exactly? (you have added a 'say' in the statement above. Is it upto the us to choose?) -- You received this message because you are subscribed to the Google Groups "Algorithm G

Re: [algogeeks] Re: Directi question-centre of the tree

2011-08-07 Thread DK
@Everyone: Wladimir has posted the correct solution to the problem and it is an O(N) bottom up solution. *The original solution:* On Wednesday, 6 October 2010 21:10:40 UTC+5:30, wladimirufc wrote: > > Find the leaf of tree then put all leaf in a queue. > > While queue not empty: > remove u fr

Re: [algogeeks] Re: Directi Question

2011-08-07 Thread shady
@kunal patil expected number of rolls required to get even sum is inverse of that i.e. 2 """ can we say like this all the time ? i have understood the alternative method, thanks :D On Sun, Aug 7, 2011 at 1:33 PM, Kunal Patil wrote: > Probability of getting an even sum in one roll is 1/2.. >

Re: [algogeeks] Re: Directi Question

2011-08-07 Thread nEvEr sMiLe bUt kEEp lAuGhIn'
@kunal patil: how can u say "Probability of getting an even sum in one roll is 1/2."... if tht is the case..can u find the ans in one go if the dice is having *5 faces*?? i mean the numbers on dice are 1 2 3 4 5 ...and it is unbiased... what will be the *Probability of getting an even sum in one r

Re: [algogeeks] Re: Directi Question

2011-08-07 Thread Kunal Patil
Probability of getting an even sum in one roll is 1/2.. Thus, expected number of rolls required to get even sum is inverse of that i.e. 2. Alternatively, Going by basics... Let P(x) be probability of getting Even sum in x rolls. P(1) = 1/2(Even) P(2) = (1/2) * (1/2) (Odd + Odd) P(3) = (1/2)

Re: [algogeeks] Re: Directi question-centre of the tree

2011-08-07 Thread programming love
Traverse the tree inorder. Store the values in an array. Find the element in the middle of the array. On Sun, Aug 7, 2011 at 8:57 AM, subramania jeeva wrote: > 5 > /\ > 6 7 >/ > 8 > > Here the centre is both 5 and 6 . we need to find both of them..:) > > > > > > > > > > Cheers

Re: [algogeeks] Re: Directi Question

2011-08-06 Thread shady
Dave shouldn't it be :: E(x) = Summation( xp(x) ) thus it should be 1*1/2 + 2*(1/2 * 1/2) + 3*(1/2 * 1/2 * 1/2) . On Sun, Aug 7, 2011 at 11:55 AM, Nitish Garg wrote: > @Dave - Can you please explain how did you generate the series? Shouldn't > it be : 1/2 + 2(1/4) + 3(1/8) and so

[algogeeks] Re: Directi Question

2011-08-06 Thread Nitish Garg
@Dave - Can you please explain how did you generate the series? Shouldn't it be : 1/2 + 2(1/4) + 3(1/8) and so on? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algo

Re: [algogeeks] Re: Directi question-centre of the tree

2011-08-06 Thread subramania jeeva
5 /\ 6 7 / 8 Here the centre is both 5 and 6 . we need to find both of them..:) Cheers ~ Jeeva ~ -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroup

[algogeeks] Re: Directi Question

2011-08-06 Thread Dave
@Shady: There is a 1/2 probability of getting an even number on the first roll. In the 1/2 of the cases where the first roll is odd, roll again and note that there is a 1/2 chance of getting an odd number. Etc. The probability of needing n rolls is 1/2 to the nth power. The series is 1 + 2 * (1/2)

[algogeeks] Re: Directi question-centre of the tree

2011-08-06 Thread Saikat Debnath
>From any node, find the farthest node by DFS, save its location(say A). Now start DFS from A, and reach the farthest node, say B. AB will be diameter of tree and longest path. The central node will be the centre of tree. O(n) solution. On Jul 27, 1:53 am, sivaviknesh s wrote: > we can do like cr

Re: [algogeeks] Re: Directi on campus

2011-08-06 Thread SANDEEP CHUGH
13.75 lacs p.a On Sat, Aug 6, 2011 at 6:41 PM, Anuj Kumar wrote: > how much does de shaw offer? > > > On Sat, Aug 6, 2011 at 6:40 PM, SANDEEP CHUGH wrote: > >> >> can any one tell me the same about D.e Shaw ?? >> >> On Sat, Aug 6, 2011 at 6:27 PM, SANDEEP CHUGH wrote: >> >>> can any one tell me

Re: [algogeeks] Re: Directi on campus

2011-08-06 Thread Anuj Kumar
how much does de shaw offer? On Sat, Aug 6, 2011 at 6:40 PM, SANDEEP CHUGH wrote: > > can any one tell me the same about D.e Shaw ?? > > On Sat, Aug 6, 2011 at 6:27 PM, SANDEEP CHUGH wrote: > >> can any one tell me the same about D.e Shaw ?? >> >> >> On Sat, Aug 6, 2011 at 5:35 PM, raj kumar wrot

Re: [algogeeks] Re: Directi on campus

2011-08-06 Thread SANDEEP CHUGH
can any one tell me the same about D.e Shaw ?? On Sat, Aug 6, 2011 at 6:27 PM, SANDEEP CHUGH wrote: > can any one tell me the same about D.e Shaw ?? > > > On Sat, Aug 6, 2011 at 5:35 PM, raj kumar wrote: > >> Really helpful info thanks guys.. >> >> -- >> You received this message because you are

Re: [algogeeks] Re: Directi on campus

2011-08-06 Thread SANDEEP CHUGH
can any one tell me the same about D.e Shaw ?? On Sat, Aug 6, 2011 at 5:35 PM, raj kumar wrote: > Really helpful info thanks guys.. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googl

  1   2   >