[algogeeks] second highest elemt in an aary

2009-09-19 Thread Nagendra Kumar
I want an algo for finding second highest element in n + log n- 2 comparisons. The algo is first find the highest number and then highest among the number which get defeated during tournament. (details in corment). Can anyone do code implemenation for this one. Thanks Nagendra

[algogeeks] Re: crazy man in the airplane

2009-09-11 Thread Nagendra Kumar
1/2 On Thu, Sep 10, 2009 at 10:51 PM, ankur aggarwal ankur.mast@gmail.com wrote: crazy man in the airplane A line of 100 airline passengers is waiting to board a plane. they each hold a ticket to one of the 100 seats on that flight. (for convenience, let's say that the nth passenger in

[algogeeks] probabiltiy + DP

2009-09-09 Thread Nagendra Kumar
@all: There are k baised coins with probabilty of coming head is P(i) i = 1 to k. If all these coins are tossed together. find the probabilty of getting i heads ( i = k). think in Dynamic Programming. -Nagendra --~--~-~--~~~---~--~~ You received

[algogeeks] Re: random number...

2009-09-07 Thread Nagendra Kumar
@ankur: u r right. On Mon, Sep 7, 2009 at 9:36 PM, ankur aggarwalankur.mast@gmail.com wrote: I KNow a sol for given a rand_5() function which generates 0 to 5 and we have to find rand_7() for 0 to 7 could not think about it... On Mon, Sep 7, 2009 at 9:26 PM, ankur aggarwal

[algogeeks] Re: Find longest palindrom in a give n string in O(N)

2009-09-06 Thread Nagendra Kumar
@all: T(i,j) : denotes the length of longest palindrome with start index i and end index j index. T(i,j )= max { 1 , if i == j; 2+T(i+1,j-1) if x[i] == x[j];

[algogeeks] Re: adobe interview question

2009-09-02 Thread Nagendra Kumar
Can anyone recheck and rephrase the question becuase i think it would be always '0' On Wed, Sep 2, 2009 at 10:40 AM, Naynnayanish.hi...@gmail.com wrote: Guys, We are anticipating an algorithm here. The input would be an array containing 0/1 representing black and white boxes. On Sep 1,

Fwd: [algogeeks] Re: String- Anagrams.

2009-09-01 Thread Nagendra Kumar
@Anil: I will request you to completly explain the things. Not just write a bit of code. So what is map and how are you implementing the insert operation. -- Forwarded message -- From: Anil C R cr.a...@gmail.com Date: Mon, Aug 31, 2009 at 7:59 PM Subject:

[algogeeks] Re: N-Ary Tree and Resource management

2009-09-01 Thread Nagendra Kumar
. On Sat, Aug 29, 2009 at 11:05 AM, nagendra kumar nagendra@gmail.com wrote: Given a n-ary tree of resources arranged hierarchically. A process needs to lock a resource node in order to use it. But,  A node cannot be locked if any of its descendant or ancestor is locked. I

[algogeeks] Re: adobe interview question

2009-09-01 Thread Nagendra Kumar
@all: Yah it's 100% true that for 32 white and 32 black we have min distance at 0. But question will become difficult when the number of white and blacks are less than 32. -Nagendra On Tue, Sep 1, 2009 at 9:30 PM, Ramaswamy Rramaswam...@gmail.com wrote: If the white and the black

[algogeeks] Re: N-Ary Tree and Resource management

2009-09-01 Thread Nagendra Kumar
descendant or ancestor is  locked    .. should not be A node cannot be locked if any of its ancestor   is locked. On Sat, Aug 29, 2009 at 11:35 PM, nagendra kumar nagendra@gmail.com wrote: Given a n-ary tree of resources arranged hierarchically. A process needs to lock a resource

[algogeeks] Re: Median Finding algorithms.

2009-08-31 Thread Nagendra Kumar
What ever you have just post here ! On Sun, Aug 30, 2009 at 5:08 PM, Nagendra Kumarnagendra@gmail.com wrote: Given a set S of n distinct numbers and a positive integer k = n. Determine the k numbers in S that are closest to the median of S. Find an O(n) algorithm

[algogeeks] Re: N-Ary Tree and Resource management

2009-08-30 Thread Nagendra Kumar
;  // Unlock the Node   node *prevChild=m;   m=m-parent;     while(m)     {      m-LockCount--;       prevChild=m;       m=m-parent;     } } Thanks, Priya On Sat, Aug 29, 2009 at 11:35 PM, nagendra kumar nagendra@gmail.comwrote: Given a n-ary tree of resources

[algogeeks] String- Anagrams.

2009-08-30 Thread Nagendra Kumar
Write a method to print all valid anagrams of a string -Nagendra --~--~-~--~~~---~--~~ 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

[algogeeks] Re: String- Anagrams.

2009-08-30 Thread Nagendra Kumar
@Anil: Dictionary is given to you. For each string t in array u = sort(t). if(s == u) print (t). If dictionary has

[algogeeks] Re: find elements in array with odd frequency

2009-08-24 Thread Nagendra Kumar
result(which basically corresponds to elements with odd frequency). _dufus On Aug 23, 8:44 am, Nagendra Kumar nagendra@gmail.com wrote: How are u doing with xor. Can u post ur thought here. Thanks Nagendra On Sun, Aug 23, 2009 at 2:07 AM, Dufusrahul.dev.si...@gmail.com wrote: We can

[algogeeks] find elements in array with odd frequency

2009-08-22 Thread nagendra kumar
Given an array of integers,Print the integers whose appareance are in odd times. Need not worry abt order while printing the output. Need Algotithm in o(n) time complexity. Need efficient space complexity. --~--~-~--~~~---~--~~ You received this message because

[algogeeks] Re: find elements in array with odd frequency

2009-08-22 Thread Nagendra Kumar
might come up with a better algo. _dufus On Aug 21, 3:01 pm, nagendra kumar nagendra@gmail.com wrote: Given an array of integers,Print the integers whose appareance are in odd times. Need not worry abt order while printing the output. Need Algotithm in o(n) time complexity. Need

[algogeeks] Re: find elements in array with odd frequency

2009-08-22 Thread Nagendra Kumar
How are u doing with xor. Can u post ur thought here. Thanks Nagendra On Sun, Aug 23, 2009 at 2:07 AM, Dufusrahul.dev.si...@gmail.com wrote: We can count or XOR but I couldnt find any advantage of XORing except for preventing overflow. _dufus On Aug 22, 5:03 pm, Nagendra Kumar nagendra

[algogeeks] Re: Find an element in sorted matrix

2009-08-21 Thread Nagendra Kumar
) is actually possible. _dufus On Aug 20, 6:41 pm, nagendra kumar nagendra@gmail.com wrote: How can we find an element in the matrix [n*n] which is sorted row wise and column wise in O(log n). --~--~-~--~~~---~--~~ You received this message because you

[algogeeks] Find an element in sorted matrix

2009-08-20 Thread nagendra kumar
How can we find an element in the matrix [n*n] which is sorted row wise and column wise in O(log n). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to