[algogeeks] Re: friend's finder

2011-03-23 Thread Ruturaj
Typically what we need to do is a BFS. But there are more advanced algorithms like Link prediction etc.. A recent paper on same topic might be an interesting read. events.linkeddata.org/ldow2011/papers/ldow2011-paper08-dhekane.pdf On Mar 22, 6:05 pm, snehal jain wrote: >  If you want to search f

[algogeeks] [brain teaser ] 23march

2011-03-23 Thread Lavesh Rawat
*A Remainder is chasing me Problem Solution* * *I just found a number with an interesting property: When I divide it by 2, the remainder is 1. When I divide it by 3, the remainder is 2. When I divide it by 4, the remainder is 3. When I divide it by 5, the remainder is 4. When I divide it by 6, the

Re: [algogeeks] [brain teaser ] 23march

2011-03-23 Thread Saravanan T
2519 On Wed, Mar 23, 2011 at 1:11 PM, Lavesh Rawat wrote: > *A Remainder is chasing me Problem Solution* > * > *I just found a number with an interesting property: > When I divide it by 2, the remainder is 1. > When I divide it by 3, the remainder is 2. > When I divide it by 4, the remainder is 3

Re: [algogeeks] Re: SPOJ problem-BRCKTS

2011-03-23 Thread bharath kannan
i found this good.. http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=lowestCommonAncestor On Mon, Mar 21, 2011 at 6:02 PM, Anurag atri wrote: > yes , please suggest a nice tutorial for segment trees .. > > > On Mon, Mar 21, 2011 at 5:48 PM, cegprakash wrote: > >> hey i want to learn seg

Re: [algogeeks] Re: SPOJ problem-BRCKTS

2011-03-23 Thread bharath kannan
but..i read this oly after my senior taught me segment trees.. On Wed, Mar 23, 2011 at 4:43 PM, bharath kannan wrote: > i found this good.. > > http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=lowestCommonAncestor > > > > On Mon, Mar 21, 2011 at 6:02 PM, Anurag atri wrote: > >> yes , plea

[algogeeks] SPOJ NUMGUESS

2011-03-23 Thread Vishnutej
Hello everyone, Im unable to understand the NUMGUESS problem in SPOJ.Can some one explain what the problem is about? Thanks in advance. -Vishnutej.Mylavarapu -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email

Re: [algogeeks] Re: SPOJ problem-BRCKTS

2011-03-23 Thread Arpit Sood
in the topcoder tutorial of the segment trees, the value of the M[node] should be modified during query, we only need to return it. Just a correction, people have mentioned it in forum also. On Wed, Mar 23, 2011 at 4:46 PM, bharath kannan wrote: > but..i read this oly after my senior taught me se

Re: [algogeeks] Re: SPOJ problem-BRCKTS

2011-03-23 Thread Arpit Sood
oops, i mean it shouldn't be modified. On Wed, Mar 23, 2011 at 6:56 PM, Arpit Sood wrote: > in the topcoder tutorial of the segment trees, the value of the M[node] > should be modified during query, we only need to return it. Just a > correction, people have mentioned it in forum also. > > > On

[algogeeks] Re: 23march

2011-03-23 Thread Dave
It is LCM(2,3,4,5,6,7,8,9,10) - 1 = 2^3 * 3^2 * 5 * 7 - 1 = 2519. LCM = least common multiple. Dave On Mar 23, 2:41 am, Lavesh Rawat wrote: > *A Remainder is chasing me Problem Solution* > * > *I just found a number with an interesting property: > When I divide it by 2, the remainder is 1. > Wh

Re: [algogeeks] SPOJ NUMGUESS

2011-03-23 Thread bharath kannan
I guess you solve it using binary search.. On Wed, Mar 23, 2011 at 6:48 PM, Vishnutej wrote: > Hello everyone, > > Im unable to understand the NUMGUESS problem in SPOJ.Can some one > explain what the problem is about? > > Thanks in advance. > > -Vishnutej.Mylavarapu > > -- > You received this mes

Re: [algogeeks] SPOJ NUMGUESS

2011-03-23 Thread saurabh singh
Yup...Its a binary search problem,Check wiki page of binary search for the same problem On Wed, Mar 23, 2011 at 8:14 PM, bharath kannan wrote: > I guess you solve it using binary search.. > > > On Wed, Mar 23, 2011 at 6:48 PM, Vishnutej > wrote: > >> Hello everyone, >> >> Im unable to understand

[algogeeks] Re: Spoj Problem

2011-03-23 Thread .bashrc
I may be wrong but if no==1000 then it becomes a[100] which is beyond your array limit On Mar 18, 12:31 am, KK wrote: > i m getting TLE for this soln and m not getting the concept used in > the above soln can anyone help?? > #include > using namespace std; > int main() > { >     int t,n,k

[algogeeks] debugging contest

2011-03-23 Thread cegprakash
i=9; switch(i){ default: printf("default"); case '1': printf("one"); break; case '2': printf("two"); break; case '9': printf("nine"); break; } -- You received this message because you are subscribed to the Google Groups "Algo

[algogeeks] debugging contest

2011-03-23 Thread cegprakash
i=9; switch(i){ default: printf("default"); case '1': printf("one"); break; case '2': printf("two"); break; case '9': printf("nine"); break; } why do i get "defaultone" as the output? -- You received this message because you a

Re: [algogeeks] debugging contest

2011-03-23 Thread Shalini Sah
place break after default or place the default statement in the end... On Wed, Mar 23, 2011 at 8:23 PM, cegprakash wrote: > i=9; >switch(i){ > default: printf("default"); > case '1': printf("one"); break; > case '2': printf("two"); break; >

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
why do i get "one" after "default"? -- 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+unsubscr...@googlegroups.com. For mo

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread Shalini Sah
since u havnt written da break statement...the case '1' also gets executed..and then when the break statement is encountered..the control comes out of the switch case On Wed, Mar 23, 2011 at 8:27 PM, cegprakash wrote: > why do i get "one" after "default"? > > -- > You received this message beca

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread saurabh singh
bcoz '9'!=9.Anything within ' '(single quotes) is a character and not int On Wed, Mar 23, 2011 at 8:27 PM, cegprakash wrote: > why do i get "one" after "default"? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this g

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
i is not equal to '1' i=1 which is equialent to 49 -- 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+unsubscr...@googlegro

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
sorry i meant '1'=49 and 9 is not 49 but how we get "one" -- 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+unsubscr...@go

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread Shalini Sah
ryt..since none of the cases match so default case is executed,..but since u havnt placed break aftr dat..case '1' too gets executed..evn if u didnt intend to do so..dats y da output "defaultone" On Wed, Mar 23, 2011 at 8:31 PM, cegprakash wrote: > i is not equal to '1' > i=1 which is equialent

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
i=9; switch(i){ default: printf("default"); case 9: printf("one"); break; case '2': printf("two"); break; case '9': printf("nine"); break; } but how the hell we get output for the above code as "one" .. why "default" not pri

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
now i got it.. first it checks whether it matches with any case. If it matches it starts executing from that case until it encounters a break. if it doesn't matches with any case then it starts executing from default and starts executing until a break. -- You received this message because you are

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread Shalini Sah
now the case 9 is matching so it gets executed...n da break statement is encountered... On Wed, Mar 23, 2011 at 8:35 PM, cegprakash wrote: > >i=9; >switch(i){ > default: printf("default"); > case 9: printf("one"); break; > case '2': printf("two");

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread saurabh singh
@cegprakash Relax shut down your computer for some time and switch on your i-pod.:) On Wed, Mar 23, 2011 at 8:37 PM, cegprakash wrote: > now i got it.. first it checks whether it matches with any case. If it > matches it starts executing from that case until it encounters a > break. > if it

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread saurabh singh
@cegprakash Relax shut down your computer for some time and switch on your i-pod.:) On Wed, Mar 23, 2011 at 8:39 PM, saurabh singh wrote: > @cegprakash Relax shut down your computer for some time and switch on your > i-pod.:) > > > > On Wed, Mar 23, 2011 at 8:37 PM, cegprakash wrote: >

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread jagannath prasad das
ascii values da...not 9 On Wed, Mar 23, 2011 at 8:39 PM, saurabh singh wrote: > @cegprakash Relax shut down your computer for some time and switch on your > i-pod.:) > > On Wed, Mar 23, 2011 at 8:39 PM, saurabh singh wrote: > >> @cegprakash Relax shut down your computer for some time and

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
i=9; switch(i){ xxx: printf("default"); yyy:printf("hello"); asdfasdf: printf("why no errors and why not printed"); case '1': printf("one"); default: switch(i){ case '1': printf("one"); break;

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread saurabh singh
Write switch and you will get error.They are not treated as labels.Read about : operator. On Wed, Mar 23, 2011 at 8:46 PM, cegprakash wrote: > i=9; >switch(i){ > xxx: printf("default"); > yyy:printf("hello"); > asdfasdf: printf("why no errors and why

[algogeeks] Re: debugging contest

2011-03-23 Thread cegprakash
what is the use of labels in switch -- 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+unsubscr...@googlegroups.com. For mo

Re: [algogeeks] Re: debugging contest

2011-03-23 Thread saurabh singh
sorry i mean case On Wed, Mar 23, 2011 at 8:49 PM, saurabh singh wrote: > > Write switch and you will get error.They are not treated as labels.Read > about : operator. > > On Wed, Mar 23, 2011 at 8:46 PM, cegprakash wrote: > >> i=9; >>switch(i){ >> xxx: printf("default"); >

Re: [algogeeks] Re: 23march

2011-03-23 Thread Kunal Patil
@dave: Very nice answer yaar..Excellent !!! On Wed, Mar 23, 2011 at 7:08 PM, Dave wrote: > It is LCM(2,3,4,5,6,7,8,9,10) - 1 = 2^3 * 3^2 * 5 * 7 - 1 = 2519. > > LCM = least common multiple. > > Dave > > On Mar 23, 2:41 am, Lavesh Rawat wrote: > > *A Remainder is chasing me Problem Solution* > >

Re: [algogeeks] Re: 23march

2011-03-23 Thread kunal srivastav
yes correct...2519 is the answer On Wed, Mar 23, 2011 at 7:08 PM, Dave wrote: > It is LCM(2,3,4,5,6,7,8,9,10) - 1 = 2^3 * 3^2 * 5 * 7 - 1 = 2519. > > LCM = least common multiple. > > Dave > > On Mar 23, 2:41 am, Lavesh Rawat wrote: > > *A Remainder is chasing me Problem Solution* > > * > > *I j

Re: [algogeeks] Re: 23march

2011-03-23 Thread Anurag atri
@Dave : like ! On Wed, Mar 23, 2011 at 11:14 PM, Kunal Patil wrote: > @dave: > Very nice answer yaar..Excellent !!! > > > On Wed, Mar 23, 2011 at 7:08 PM, Dave wrote: > >> It is LCM(2,3,4,5,6,7,8,9,10) - 1 = 2^3 * 3^2 * 5 * 7 - 1 = 2519. >> >> LCM = least common multiple. >> >> Dave >> >> On Ma

Re: [algogeeks] Re: Coding Round

2011-03-23 Thread balaji a
hi i got till the third round of technical interview out of the four rounds and got eliminated in third round.anyways thnx for ur support dude :-) On Tue, Mar 22, 2011 at 12:51 PM, balaji a wrote: > Thnx :-) I am from SSN College of Engineering,Chennai > > > On Tue, Mar 22, 2011 at 12:28

Re: [algogeeks] Re: Coding Round

2011-03-23 Thread Akash Mukherjee
kul man...wud appreciate if u cud post your question On Wed, Mar 23, 2011 at 11:28 PM, balaji a wrote: > hi i got till the third round of technical interview out of the four rounds > and got eliminated in third round.anyways thnx for ur support dude :-) > > > On Tue, Mar 22, 2011 at 12:51 PM

Re: [algogeeks] Re: Coding Round

2011-03-23 Thread kunal srivastav
hi people, could someone tell me in detail what all things to prepare for amazon including the resources to consult for the same?? it would be really helpful On Thu, Mar 24, 2011 at 12:11 AM, Akash Mukherjee wrote: > kul man...wud appreciate if u cud post your question > > > On Wed, Mar 23, 2011

[algogeeks] Re: random number generator

2011-03-23 Thread Don
Here is another function which probably does not operate the way you intended, but which meets the specifications. bool uniform() { static unsigned int count; if (non_uniform()) ++count; return ((count >> 31) == 1); } On Mar 17, 9:24 am, saurabh agrawal wrote: > Given a  function which ret

Re: [algogeeks] Re: Coding Round

2011-03-23 Thread balaji a
First I had a paper pen coding round. The questions were: 1) There are two sorted linked lists. Write a code to return the merged linked list which is also sorted. No additional nodes must be used. 2) Design a DS that would do Push(),Pop(), and GetMax() elements at complexity O(1) 3) Do a BFS

Re: [algogeeks] Re: Coding Round

2011-03-23 Thread balaji a
The main thing they are testing is Problem Solving and the Algorithm Designing ability. Coding Ability is only next. If you have good knowledge in Data Structures and good Problem Solving skills with coding ability you can easily crack through the interview. This is what i infered from my experienc

Re: [algogeeks] Re: Find the first K smallest element from 1 million sized array ...Amazon Question..

2011-03-23 Thread Ankit Sinha
Guys, My intention was to understand how to manage max heap of k size into memory. Means we have millions of numbers that we can't load into RAM then how in the very first go we going to load only k size and how will track of rest numbers. Can anybody code it? Do we need file to store million numb

[algogeeks] Suggestions

2011-03-23 Thread saurabh singh
Hi I have been working on a progrmming judge that can be deployed in my college.I have already developed a prototype in bash.I want it to be as general as possible,just like spoj,but i also want to add features to it like copying of source code.Moreover to analyse the design of the code i need a

[algogeeks] Re: Suggestions

2011-03-23 Thread saurabh singh
On Thu, Mar 24, 2011 at 10:19 AM, saurabh singh wrote: > Hi > I have been working on a progrmming judge that can be deployed in my > college.I have already developed a prototype in bash.I want it to be as > general as possible,just like spoj,but i also want to add features to it > like detectin

[algogeeks] Re: Find the first K smallest element from 1 million sized array ...Amazon Question..

2011-03-23 Thread Dave
@Ankit: You read in the first k numbers and form a max-heap of these numbers. This takes O(k) space. Then you read the rest of the file one number at a time. If the number is greater than the root of the max heap, then it is not one of the k smallest numbers. If it less than the root, replace the r

[algogeeks] Application of Prime Number . An Interesting For Geeks

2011-03-23 Thread bittu
yesterday one of the my friends asked this Q to me prove with correctness that "Every even integer greater than 2 can be expressed as the sum of two primes" e.g 4 = 2 + 2 6 = 3 + 3 10 = 7 + 3 or 5 + 5 14 = 3 + 11 or 7 + 7 Explain & Derive The Time ,Space Complexity of Algor

Re: [algogeeks] [brain teaser ] 22march

2011-03-23 Thread anand karthik
First start 7 & 4. Turn 4 as soon as it is over. Then turn 7 as soon as it is over. By this time 7 minutes are gone and there is one minute left in 4. So by the time 4 is over, 7 has 6 mintes left. Then immediately invert 7, which will count the last one Minute. 7,4 - 3,0 - 3,4 - 0,1 - 7,1 - 6,0 -

[algogeeks] Application of OOD(Object Oriented Design) & System Design -Design Clock Room..??

2011-03-23 Thread bittu
Design a system to manage clock room ( used at railway station). Like what data structure, how ? U need to give O(1) time solution + small space complexity. Thanks Shashank Mani -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to t

[algogeeks] [brain teaser ] 24march

2011-03-23 Thread Lavesh Rawat
*Desert Gold Problem Solution* Two men found a whole bag of sand gold (its not solid) treasure in the desert. Time came when they had to split thier ways and devide this whole bag. However, they dont have any kind of measuring equipment/tool. Nothing. Just 2 bags. (of course, one is full with sand

[algogeeks] An Interesting Question Calculate nth Power of Integer

2011-03-23 Thread bittu
How you will print the 100th power of a single digit( which is of type int). How do you maintain that big number in memory? Lets C The Approach Thank & Regards Shashank -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group,