[algogeeks] Re: Directi Question

2012-06-16 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

[algogeeks] expectation values..

2012-06-16 Thread Gaurav Popli
What is the expected number of throws of his die while it has N sides so that each number is rolled at least once? e.g for n=2 ans 3.00 n=12 ans is 37.24... i refrd to expectation tutuorial at http://www.codechef.com/wiki/tutorial-expectation but still couldnt get the logic... any help? --

[algogeeks] Re: Amazon Interview Question

2012-06-16 Thread algogeek
could u explain how would you use a trie for this?? On Thursday, June 14, 2012 1:01:00 PM UTC+5:30, Mohit Rathi wrote: Hi, *There are two arrays of length 100 each. Each of these has initially n (n=100) elements. First array contains names and the second array contains numbers such that

[algogeeks] Re: Amazon Interview Question

2012-06-16 Thread enchantress
Store each of the words in array in a trie and mark the end of the word by its corresponding entry in the second array. Now if u are searching for a word it'll take O(length of word) if there is a mismatch at any point you know the word is not present in array1 and add it to the trie or else

[algogeeks] Explain the output of this code:

2012-06-16 Thread Shubham Sandeep
#includestdio.h main() { int a[] = {0,1,2,3,4}; int *p[] = {a,a+1,a+2,a+3,a+4}; int **pp= p; printf(%d, %d, %d , *pp-a, pp-p, **pp); pp++; pp++;; ++pp; *++pp; printf(%d, %d, %d , pp-p, *pp-a, **pp); } output:0 ,0 ,0 ,4 ,4 ,4 -- You received this message

Re: [algogeeks] Explain the output of this code:

2012-06-16 Thread Sajal Choudhary
*p[] is an array of pointers pointing to the address of array a[] .. i.e p[0] pointing to a[0]..p[1] to a[1] and so on. *pp is a pointer to a pointer. It is storing the address of array of pointers p. 1. *pp gives value at pointed by p[0]. This is 'a'. So when 'a' is subtracted from it, it

[algogeeks] Re: Can anyone plz explain how we get this output

2012-06-16 Thread rvkmr102
If you evaluate the expressions from right to left and print the result from left to right , it will be clear. On Thursday, June 14, 2012 11:41:04 AM UTC+5:30, Ajesh js wrote: main() { int a=10,b=5; printf(%d %d %d\n,a++,a,++a); printf(%d %d %d\n,++b,b,b++); } output

Re: [algogeeks] expectation values..

2012-06-16 Thread Amitesh Singh
This problem is similar to Coupan collector problem. http://en.wikipedia.org/wiki/Coupon_collector%27s_problem In your case the answer is [image: For N-Dice ; \newline \sum_{i=1}^{N} N/i \newline for\; N =~2 ; \newline \sum_{i=1}^{2} 2/i = 2/1 + 2/2 = 3 \newline] Hope it helps! -- Amitesh

[algogeeks] Analysis of Partial Sorting.

2012-06-16 Thread Amitesh Singh
Hi Guys, *Problem: *Rearrange a given array with n elements, so that m places contain the m smallest elements in ascending order. *Solution 2:* using QuickSort method approach. [image: n = r -p + 1] [image: \bold{PARTIAL-QUICKSORT(A,p,r,m)}: \newline if\; pr \newline q \leftarrow

Re: [algogeeks] expectation values..

2012-06-16 Thread Amitesh Singh
just curious to know if this question is asked in any interviews? Google interview? -- Amitesh On Sun, Jun 17, 2012 at 12:09 AM, Amitesh Singh singh.amit...@gmail.comwrote: This problem is similar to Coupan collector problem. http://en.wikipedia.org/wiki/Coupon_collector%27s_problem In

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 hemesh.mn...@gmail.comwrote: + 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 divyekap...@gmail.com

Re: [algogeeks] Adobe interiew question

2012-06-16 Thread Decipher
Also, goto cannot jump across functions , which imposes a major setback for its use in exception handling -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit

Re: [algogeeks] Find the Max from each sub-array of size k

2012-06-16 Thread Sourabh Singh
@ALL can be solved using segment tree . :-) On Fri, Sep 2, 2011 at 9:49 AM, Anup Ghatage ghat...@gmail.com wrote: I just checked Shashank's blog post. The Deque solution is awesome :) -- Anup Ghatage -- You received this message because you are subscribed to the Google Groups Algorithm