Re: [algogeeks] C++ problem..

2011-05-25 Thread Aakash Johari
Change it to that.. It will still work.. Don't worry :) On Tue, May 24, 2011 at 10:56 PM, Balaji S balaji.ceg...@gmail.com wrote: but constructor is A(int *m=0*) { a=m; } not A*(int m*) { a = m; } ??? -- You received this message because you

Re: [algogeeks] Edit distance

2011-05-25 Thread Aakash Johari
Sorry, it can't be because of the preferences :(... On Tue, May 24, 2011 at 11:07 PM, Aakash Johari aakashj@gmail.comwrote: I think, it is because of the preference of operations. I have also implemented it and it's returning 5. Try for some modifications in the algorithm. On Tue, May

Re: [algogeeks] Edit distance

2011-05-25 Thread Akshata Sharma
still not getting!! :( On Wed, May 25, 2011 at 11:38 AM, Aakash Johari aakashj@gmail.comwrote: Sorry, it can't be because of the preferences :(... On Tue, May 24, 2011 at 11:07 PM, Aakash Johari aakashj@gmail.comwrote: I think, it is because of the preference of operations. I have

Re: [algogeeks] C++ problem..

2011-05-25 Thread Balaji S
ya.. thanks :) it works. but.. we are initializing m to 0 in everycall ryt.. ? then how does 1,2,3,is initialized?? -- 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

Re: [algogeeks] Edit distance

2011-05-25 Thread immanuel kingston
http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance On Wed, May 25, 2011 at 11:50 AM, Akshata Sharma akshatasharm...@gmail.comwrote: still not getting!! :( On Wed, May 25, 2011 at 11:38 AM, Aakash Johari aakashj@gmail.comwrote: Sorry, it can't be because of the

Re: [algogeeks] Edit distance

2011-05-25 Thread saurabh singh
I GOT AC WITH Demarau-Levenshtein.No optimizations or changes required as far as i remember On Wed, May 25, 2011 at 12:17 PM, immanuel kingston kingston.imman...@gmail.com wrote: http://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance On Wed, May 25, 2011 at 11:50 AM, Akshata

[algogeeks] Round Robin Schedulling Problem

2011-05-25 Thread ankit sambyal
Hey guys, I tried to solve this problem https://www.spoj.pl/problems/RRSCHED/I am getting TLE.Does anybdy has any idea of how to solve this problem in an efficient manner ?? Regards, Ankit -- You received this message because you are subscribed to the Google Groups Algorithm

[algogeeks] [brain teaser ] Mystery Puzzle Servant Wish 25 may

2011-05-25 Thread Lavesh Rawat
*Mystery Puzzle Servant Wish * * * ** *Once upon a time, in the West Lake village, a servant lived with his master. After service of about 30 years, his master became ill and was going to die. One day, the master called his servant and asked him for a wish. It could be any wish but just one. The

Re: [algogeeks] [brain teaser ] Mystery Puzzle Servant Wish 25 may

2011-05-25 Thread ArPiT BhAtNaGaR
master can give only monet so obviously money On Wed, May 25, 2011 at 12:48 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote: *Mystery Puzzle Servant Wish * * * ** *Once upon a time, in the West Lake village, a servant lived with his master. After service of about 30 years, his master became

Re: [algogeeks] [brain teaser ] Mystery Puzzle Servant Wish 25 may

2011-05-25 Thread vaibhav shukla
he should wish that my mother could see his grand child playing with his very rich grand-father On Wed, May 25, 2011 at 1:20 PM, ArPiT BhAtNaGaR arpitbhatnagarm...@gmail.com wrote: master can give only monet so obviously money On Wed, May 25, 2011 at 12:48 PM, Lavesh Rawat

[algogeeks] Re: [brain teaser ] Mystery Puzzle Servant Wish 25 may

2011-05-25 Thread Dumanshu
hmm... u r right. my mother should see my child in a very big swing made of gold and studded with diamonds :D On May 25, 12:56 pm, vaibhav shukla vaibhav200...@gmail.com wrote: he should wish that my mother could see his grand child playing with his very rich grand-father On Wed, May 25, 2011

Re: [algogeeks] C++ problem..

2011-05-25 Thread Gaurav Saxena
Actually A(int *m=0*) { a=m; } not A*(int m*) { a = m; } means m has a default value of 0 ie this value will be used if no parameter is given . So when you pass it a parameter default value is simply ignored. On Wed, May 25, 2011 at 12:15 PM, Balaji S

[algogeeks] Re: [brain teaser ] Mystery Puzzle Servant Wish 25 may

2011-05-25 Thread Dumanshu
assume master is someone with supernatural powers... because nothing is specified :) actually this puzzle dates back to some age of gods and goddesses... Indian Mythology. On May 25, 12:50 pm, ArPiT BhAtNaGaR arpitbhatnagarm...@gmail.com wrote: master can give only monet so obviously money On

Re: [algogeeks] Round Robin Schedulling Problem

2011-05-25 Thread anshu mishra
first for every element get the number of element before its index have less value. example L[]= 0 0 1 1 3 D[] = 8 1 3 3 8 IN[] = 0 1 2 3 4 you can use segment tree for this it will give solution in o(nlogn); after that sort the array and start from 0th index D[] = {1 3 3 8 8}

Re: [algogeeks] Round Robin Schedulling Problem

2011-05-25 Thread anshu mishra
two thing i have forgot do; that is at every iteration rem--; last = D[i-1]; -- 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] c output

2011-05-25 Thread sourabh jakhar
#includestdio.h #includestdio.h #includeconio.h #define PRINTX printf(%d\n,x) main() { int x=2,y,z; x*=3 + 2; PRINTX; x*= y = z = 4; PRINTX; x = y == z; PRINTX; x == ( y = z ); PRINTX; getch(); } can anyone explain the output -- SOURABH JAKHAR,(CSE)(3 year) The Law of Win

Re: [algogeeks] c output

2011-05-25 Thread Naveen Kumar
output is 10 40 1 1 10 because x = x*(3+2) = 2 * (3+2) 40 because x = x*4 = 10 * 4 1 because x = y == z which is x = 4 == 4 which become x = 1 1 becase value of x is not changed in 4th expression. On Wed, May 25, 2011 at 3:35 PM, sourabh jakhar sourabhjak...@gmail.comwrote: #includestdio.h

Re: [algogeeks] c output

2011-05-25 Thread Shachindra A C
1st print : x = x * (3 + 2) - 10 2nd print : x = x * 4 - 40 : while evaluating the expression, the rightmost result will be used 3rd print : x = (4 == 4) - 1 4th print : x == ( y = z ) evaluates to false; prev val of x, 1 is printed On Wed, May 25, 2011 at 3:35 PM, sourabh jakhar

Re: [algogeeks] c output

2011-05-25 Thread sourabh jakhar
ok i got it is the precedence of *= is less than of + On Wed, May 25, 2011 at 3:52 PM, Shachindra A C sachindr...@gmail.comwrote: 1st print : x = x * (3 + 2) - 10 2nd print : x = x * 4 - 40 : while evaluating the expression, the rightmost result will be used 3rd print : x = (4 == 4) - 1

Re: [algogeeks] Round Robin Schedulling Problem

2011-05-25 Thread ankit sambyal
thanks anshu, i m working with segment trees now. Ur algo seems convincing to me. nice solution !! Ankit On Wed, May 25, 2011 at 1:54 AM, anshu mishra anshumishra6...@gmail.comwrote: two thing i have forgot do; that is at every iteration rem--; last = D[i-1]; -- You received this

Re: [algogeeks] C++ problem..

2011-05-25 Thread Aakash Johari
@balaji: that's the default value for the parameter. Basically, the advantage of the default parameter is that you need not to explicitly define the non-parameterized constructor. See the difference yourself with following 2 examples. 1) *class A { int m; A (int

[algogeeks] Doctorate Degree

2011-05-25 Thread Geo News
*Study Accountancy, London ACCA, CIMA, Diplomas, MBA + ACCA Free Sage Financial Modelling http://bit.ly/khS0GB Doctorate Degree Doctorate Business Administration Starts Aug 2010 | Apply today! http://bit.ly/khS0GB --- * -- You received this message because you are subscribed to

Re: [algogeeks] Edit distance

2011-05-25 Thread Aakash Johari
Yes, It's done. There was some mistakes in indexing in my code. I corrected and got AC for the problem. :) On Tue, May 24, 2011 at 11:53 PM, saurabh singh saurab...@gmail.com wrote: I GOT AC WITH Demarau-Levenshtein.No optimizations or changes required as far as i remember On Wed, May 25,

[algogeeks] EOF in Python for SPOJ

2011-05-25 Thread Vishnutej
Hello everyone, I'm new to python.How can I check the EOF for inputs in SPOJ? Thanks in advance!! -Vishnutej -- 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] EOF in Python for SPOJ

2011-05-25 Thread abhijith reddy
while(1): try: # code # # except EOFError: break On Wed, May 25, 2011 at 8:41 PM, Vishnutej mylavarapu.vishnu...@gmail.comwrote: Hello everyone, I'm new to python.How can I check the EOF for inputs in SPOJ? Thanks in advance!! -Vishnutej -- You received this

Re: [algogeeks] EOF in Python for SPOJ

2011-05-25 Thread Vishnutej Mylavarapu
Thnx a lot abhijith.. Do you have any links for tutorials for beginners? On Wed, May 25, 2011 at 8:42 PM, abhijith reddy abhijith200...@gmail.comwrote: while(1): try: # code # # except EOFError: break On Wed, May 25, 2011 at 8:41 PM, Vishnutej

Re: [algogeeks] EOF in Python for SPOJ

2011-05-25 Thread abhijith reddy
A Byte of Python - Freely available online. http://docs.python.org/library/; - Python Library Reference. On Wed, May 25, 2011 at 8:52 PM, Vishnutej Mylavarapu mylavarapu.vishnu...@gmail.com wrote: Thnx a lot abhijith.. Do you have any links for tutorials for beginners? On Wed, May 25,

Re: [algogeeks] EOF in Python for SPOJ

2011-05-25 Thread Aman (neshu) Agarwal
for line in sys.stdin: print line, print eof -- Aman Agarwal -- 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

Re: [algogeeks] EOF in Python for SPOJ

2011-05-25 Thread Aman (neshu) Agarwal
do not forget to import sys import sys for line in sys.stdin: print line, print eof On Wed, May 25, 2011 at 9:12 PM, Aman (neshu) Agarwal neshuagarwal1...@gmail.com wrote: for line in sys.stdin: print line, print eof -- Aman Agarwal -- Aman Agarwal -- You received this

[algogeeks] Java/J2EE Developer -- Chicago, IL -- 6 month contract to hire

2011-05-25 Thread sohail panzer
Hello, Hope you are doing well. I am a technical recruiter with Panzer Solutions LLC Software Implementing and IT consulting company located in CT. Please go through the Job Description and send me your updated resume with contact information. * Please reply at soh...@panzersolutions.com* Title

[algogeeks] urgent

2011-05-25 Thread sunny
hi all of you you all can earn 2000+ money from internet by just spending sometime.i have done this and it's awesome really ..so i am sharing the link . i will also get benefitso hurryit takes maximum 2 minuts for registration

Re: [algogeeks] EOF in Python for SPOJ

2011-05-25 Thread Vishnutej Mylavarapu
What are the cases for which I might get NZEC?? On Wed, May 25, 2011 at 9:13 PM, Aman (neshu) Agarwal neshuagarwal1...@gmail.com wrote: do not forget to import sys import sys for line in sys.stdin: print line, print eof On Wed, May 25, 2011 at 9:12 PM, Aman (neshu) Agarwal

[algogeeks] Arrays

2011-05-25 Thread Piyush Sinha
Write a function int triangle( int A [ ] ) that given a zero-indexed array A consisting of N integers returns 1 if there exists a triple (P, Q, R) such that 0 = P Q R N and A[P] + A[Q] A[R], A[Q] + A[R] A[P], A[R] + A[P] A[Q]. The function should return 0 if such triple does not exist.

[algogeeks] Admin of Group

2011-05-25 Thread anuj agarwal
Hi, Are there any admins on this group? I recently joined this group and i liked the discussions going on here. But there is a problem which hurts is that unlike other groups which are moderated by certain admin guys (also active members of group), this one is not. So we are receiving lots of

Re: [algogeeks] Arrays

2011-05-25 Thread immanuel kingston
Brute force Approach would be int checkForTriangle(int a, int b, int c) { return (a + b c) (b + c a) (a + c b); } int triangle (int a[], int n) { if (a == null || n = 0) return 0; for (int i=0 ; i n ; i++) { for (int j=i + 1; j n; j++ ) { for (int

[algogeeks] Java/J2EE Developer -- Chicago, IL -- 6 month contract to hire

2011-05-25 Thread sohail panzer
Hello, Hope you are doing well. I am a technical recruiter with Panzer Solutions LLC Software Implementing and IT consulting company located in CT. Please go through the Job Description and send me your updated resume with contact information. * Please reply at soh...@panzersolutions.com* Title

Re: [algogeeks] spoj--two squares problem

2011-05-25 Thread Saikat Debnath
I think your problem is you are using int. Use long long. On Thu, May 26, 2011 at 12:29 AM, ricky moon.afr...@gmail.com wrote: can anyone help me out with this problem: https://www.spoj.pl/problems/TWOSQRS/ It runs on my machine with this code but it gives wrong ans on their site.

[algogeeks] Java Developer/Grails -- Phoenix, AZ -- 3+ month contract

2011-05-25 Thread sohail panzer
Hello, Hope you are doing well. I am a technical recruiter with Panzer Solutions LLC Software Implementing and IT consulting company located in CT. Please go through the Job Description and send me your updated resume with contact information. *Please reply at soh...@panzersolutions.com * Title

Re: [algogeeks] Round Robin Schedulling Problem

2011-05-25 Thread Ashish Goel
can a descriptive explaination be provided to this, unfortunately not clear the idea of for loop Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Wed, May 25, 2011 at 4:50 PM, ankit sambyal ankitsamb...@gmail.comwrote: thanks anshu, i m working

Re: [algogeeks] Round Robin Schedulling Problem

2011-05-25 Thread Ashish Goel
Hi I was just thinking of a simpler solution find sum of the time all processes will take, lets call that sum, say for 8,1,3,3,8 it is 23 walk over each process to see if this has been completely executed, if not set the out[i]=curTime and reduce the T[i] by 1.(out is the process final end time

Re: [algogeeks] Round Robin Schedulling Problem

2011-05-25 Thread Anand
@Ashish: complexity for your solution is O(n*Total seconds) On Wed, May 25, 2011 at 5:25 PM, Ashish Goel ashg...@gmail.com wrote: Hi I was just thinking of a simpler solution find sum of the time all processes will take, lets call that sum, say for 8,1,3,3,8 it is 23 walk over each

Re: [algogeeks] Arrays

2011-05-25 Thread Aakash Johari
Sort array and then apply binary search. On Wed, May 25, 2011 at 11:31 AM, immanuel kingston kingston.imman...@gmail.com wrote: Brute force Approach would be int checkForTriangle(int a, int b, int c) { return (a + b c) (b + c a) (a + c b); } int triangle (int a[], int n) {

Re: [algogeeks] spoj--two squares problem

2011-05-25 Thread subramania jeeva
Fermat's theorem will be better for this problem..:) Cheers ~ Jeeva ~ On Thu, May 26, 2011 at 12:42 AM, Saikat Debnath crazysai...@gmail.comwrote: I think your problem is you are using int. Use long long. On Thu, May 26, 2011 at 12:29 AM, ricky moon.afr...@gmail.com wrote:

Re: [algogeeks] spoj--two squares problem

2011-05-25 Thread Balaji S
Fermat's little theroem ??? -- 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 more

Re: [algogeeks] spoj--two squares problem

2011-05-25 Thread subramania jeeva
see http://en.wikipedia.org/wiki/Fermat%27s_theorem_on_sums_of_two_squares Hope it'll help...:) Cheers ~ Jeeva ~ On Thu, May 26, 2011 at 9:17 AM, Balaji S balaji.ceg...@gmail.com wrote: Fermat's little theroem ??? -- You received this message because you are subscribed to

Re: [algogeeks] Round Robin Schedulling Problem

2011-05-25 Thread anshu mishra
L[i] tells how many elements D[j] less than D[i] such that j i ; for this u have to use BIT, segment tree, or any balanced BST(balanced implies to avoid the worst case that is o(n^2)); rem = n; curtime = 0; last = 0; for (i = 0; i n;) ans[IN[i]] = curtime + (D[i] - last - 1) * rem + (i

Re: [algogeeks] Edit distance

2011-05-25 Thread saurabh singh
Yeah indexing problem costed me 16 WA's/:) On Wed, May 25, 2011 at 5:56 PM, Aakash Johari aakashj@gmail.comwrote: Yes, It's done. There was some mistakes in indexing in my code. I corrected and got AC for the problem. :) On Tue, May 24, 2011 at 11:53 PM, saurabh singh