[algogeeks] Re: optimum algo for second largest

2009-10-11 Thread Shishir Mittal
It has been discussed here http://groups.google.com/group/algogeeks/browse_thread/thread/5a3ccc1bfb4617fa/885438e251ffd330?lnk=gst&q=second+highest+element#885438e251ffd330 On Sun, Oct 11, 2009 at 8:21 PM, Manisha wrote: > > First find out the largest element and it requires n-1 comparison. > Le

[algogeeks] Re: 100!

2009-10-11 Thread ankur aggarwal
@gautam * find sum of all the digits in number->100!* now show wat is significance of 9 in this ques ?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to al

[algogeeks] Re: Y shaped linklist

2009-10-11 Thread ankur aggarwal
@manisha that is the ques.. there are many soln for 2 traversal like loop in the linklist. simple travesal n many more.. On Sun, Oct 11, 2009 at 1:20 PM, ankur aggarwal wrote: > > > *...@manisha >> " one traversal for each of the lists" >> * >> > "After* two traversals, *both pointers will surel

[algogeeks] Re: 100!

2009-10-11 Thread Gautham Muthuravichandran
I meant the final single digit number that one gets...for eg if the sum is 123 then the answer would be 1+2+3 = 6. On Sun, Oct 11, 2009 at 6:59 PM, Prunthaban Kanthakumar wrote: > > > On Sun, Oct 11, 2009 at 6:40 PM, Gautham Muthuravichandran > wrote: >> >> 9.. All the factorials above 5! is di

[algogeeks] Re: 100!

2009-10-11 Thread Gautham Muthuravichandran
@ankur 6! = 1*2*3*4*5*6 = 1*2*3*4*5*(3*2) = 1*2*(3*3)*4*5*2 = 1*2*9*4*5*2 = 9 * ( 1*2*4*5*2 ) => 9x ( divisible by 9 ) Factorial of any number greater than 6 would be a multiple of 6! or a multiple of 9. ie divisible by 9. On Sun, Oct 11, 2009 at 7:29 PM, ankur aggarwal wrote:

[algogeeks] Re: optimum algo for second largest

2009-10-11 Thread Manisha
First find out the largest element and it requires n-1 comparison. Lets say we have 8 elements then we need 7 comparison to decide largest. Imagine the tree structure that you will use to find out largest. 21 15 21 9

[algogeeks] Re: 100!

2009-10-11 Thread Anil C R
I kinda cheated on this question myself... I used python ;) ankur aggarwal wrote: > @gautam > i dont understand > > On Sun, Oct 11, 2009 at 6:59 PM, Prunthaban Kanthakumar > mailto:pruntha...@gmail.com>> wrote: > > > > On Sun, Oct 11, 2009 at 6:40 PM, Gautham Muthuravichandran > mailto:ga

[algogeeks] Re: gold bar

2009-10-11 Thread sharad kumar
make cuts to get pieces like 1,2and ,4 On Sun, Oct 11, 2009 at 6:19 PM, ankur aggarwal wrote: > You've got someone working for you for seven days and a gold bar to pay > them. The gold bar is segmented into seven connected pieces. You must give > them a piece of gold at the end of every day. If yo

[algogeeks] gold bar

2009-10-11 Thread ankur aggarwal
You've got someone working for you for seven days and a gold bar to pay them. The gold bar is segmented into seven connected pieces. You must give them a piece of gold at the end of every day. If you are only allowed to make two breaks in the gold bar, how do you pay your worker? --~--~-~-

[algogeeks] minimum number of comparisons

2009-10-11 Thread ankur aggarwal
Q1. Give steps to sort 5 numbers in minimum number of comparisons .Justify that number of comparisons are minimum. Extend your argument for *N*numbers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks"

[algogeeks] Re: Y shaped linklist

2009-10-11 Thread Manisha
Correct. It will not be exactly one traversal of each list. More precisely, in worst case each pointer will traverse one list completely and then another list from beginning to intersection point. On Oct 11, 12:49 pm, ankur aggarwal wrote: > *...@manisha > " one traversal for each of the lists"

[algogeeks] Re: 100!

2009-10-11 Thread ankur aggarwal
@gautam i dont understand On Sun, Oct 11, 2009 at 6:59 PM, Prunthaban Kanthakumar < pruntha...@gmail.com> wrote: > > > On Sun, Oct 11, 2009 at 6:40 PM, Gautham Muthuravichandran < > gautha...@gmail.com> wrote: > >> >> 9.. All the factorials above 5! is divisible by 9. >> > > Divisible by 9 does n

[algogeeks] Re: 100!

2009-10-11 Thread Prunthaban Kanthakumar
On Sun, Oct 11, 2009 at 6:40 PM, Gautham Muthuravichandran < gautha...@gmail.com> wrote: > > 9.. All the factorials above 5! is divisible by 9. > Divisible by 9 does not mean exactly 9. > > -Gautham > > On Sun, Oct 11, 2009 at 11:54 AM, Debanjan wrote: > > > > > > > > On Oct 11, 10:29 am, Anil

[algogeeks] Re: 100!

2009-10-11 Thread Gautham Muthuravichandran
9.. All the factorials above 5! is divisible by 9. -Gautham On Sun, Oct 11, 2009 at 11:54 AM, Debanjan wrote: > > > > On Oct 11, 10:29 am, Anil C R wrote: >> Project Euler!! > > I remember I cheated on this problem :P At first I used my SPOJ FCTRL2 > solution to get the factorial of 100 then I

[algogeeks] Re: 100!

2009-10-11 Thread Debanjan
On Oct 11, 10:29 am, Anil C R wrote: > Project Euler!! I remember I cheated on this problem :P At first I used my SPOJ FCTRL2 solution to get the factorial of 100 then I simply add up those digits :D Most problems of Project Euler can be brute forced ! --~--~-~--~~~--

[algogeeks] Re: Y shaped linklist

2009-10-11 Thread ankur aggarwal
*...@manisha " one traversal for each of the lists" * --~--~-~--~~~---~--~~ 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 g

[algogeeks] Re: Y shaped linklist

2009-10-11 Thread ankur aggarwal
*...@manisha > " one traversal for each of the lists" > * > "After* two traversals, *both pointers will surely meet at intersection point.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.

[algogeeks] Re: Interesting array multiplication problem

2009-10-11 Thread harit agarwal
@Debanjan really nice solution --~--~-~--~~~---~--~~ 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

[algogeeks] Re: 100!

2009-10-11 Thread Channa Bankapur
Project Euler (http://projecteuler.net) has an exciting set of questions. Please don't spoil the fun of it by discussing them here. Once you solve a problem in Project Euler, you get access to the discussion thread of the problem. ./Channa On Sun, Oct 11, 2009 at 10:59 AM, Anil C R wrote: > > P