[algogeeks] Re: Missing numbers
@Vivek I had told abt tat border case already once.. Suppose the two missin numbers are greater than n, then m==0 when exitin the loop. So they will be n+1 and n+2 only. in case, one of the missin numbers is greater than n, then m==1, and can be simply found by subtracting the (array_sum+x[0] ) from (sumof 1 to n+2) numbers. Hope it works.. --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Missing numbers
appadi partha vikram solutiona la square number ke variable kadeyathu wen n is very large On Sat, Aug 1, 2009 at 7:32 AM, sharad kumar wrote: > cant u use a string yaar.fruity gethu thaan > > > On Fri, Jul 31, 2009 at 9:57 PM, Vivek S wrote: > >> N! overflows... >> Try to write a program to find the value of 30! >> You don't have a variable that is large enough to store such a big >> number... >> >> 2009/7/31 sharad kumar >> >>> check this out >>> >>> Let x and y be the missing number, >>> >>> Now equation 1 is : x + y = [n(n+1)/2] - S >>> equation 2 is: x * y = N! /P >>> solve both we get elements >>> >>> On Fri, Jul 31, 2009 at 8:27 PM, Devi G wrote: >>> The logic is actually simple. Tot if we mark in some way an element when it's scanned, we can find the missing numbers in the second scannin. 3,5,1,2,9,10,8,6 When for loop sees '3' it knows elt 3 is there. So multiplies the number at 3rd position by some arbitrary number. (* I've taken the arbitrary number to be n here but CORRECT ONE IS n+3 cos n will fail in some cases *) so, when it sees '5' multiplies the number at 5th position by n+3. It skips when the numbr is greater than n. n+3 = 11 here. So,after first loop, 33, 55, 11, 2 , 99, 110, 8, 66. So now, in the second scan, the indices of all elts that are divisible by n+3 are present in the array. elts at 4th and 7th positions are not divisible. hence missing numbers are 4 and 7. >>> >>> >>> >> >> >> -- >> "Reduce, Reuse and Recycle" >> Regards, >> Vivek.S >> >> >> >> > --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Missing numbers
cant u use a string yaar.fruity gethu thaan On Fri, Jul 31, 2009 at 9:57 PM, Vivek S wrote: > N! overflows... > Try to write a program to find the value of 30! > You don't have a variable that is large enough to store such a big > number... > > 2009/7/31 sharad kumar > >> check this out >> >> Let x and y be the missing number, >> >> Now equation 1 is : x + y = [n(n+1)/2] - S >> equation 2 is: x * y = N! /P >> solve both we get elements >> >> On Fri, Jul 31, 2009 at 8:27 PM, Devi G wrote: >> >>> The logic is actually simple. Tot if we mark in some way an element when >>> it's scanned, we can find the missing numbers in the second scannin. >>> >>> 3,5,1,2,9,10,8,6 >>> >>> When for loop sees '3' it knows elt 3 is there. So multiplies the number >>> at 3rd position by some arbitrary number. (* I've taken the arbitrary >>> number to be n here but CORRECT ONE IS n+3 cos n will fail in some cases >>> *) >>> >>> so, when it sees '5' multiplies the number at 5th position by n+3. >>> It skips when the numbr is greater than n. >>> >>> n+3 = 11 here. >>> >>> So,after first loop, >>> 33, 55, 11, 2 , 99, 110, 8, 66. >>> >>> So now, in the second scan, the indices of all elts that are divisible by >>> n+3 are present in the array. >>> elts at 4th and 7th positions are not divisible. hence missing numbers >>> are 4 and 7. >>> >>> >>> >>> >>> >> >> >> > > > -- > "Reduce, Reuse and Recycle" > Regards, > Vivek.S > > > > --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Missing numbers
N! overflows... Try to write a program to find the value of 30! You don't have a variable that is large enough to store such a big number... 2009/7/31 sharad kumar > check this out > > Let x and y be the missing number, > > Now equation 1 is : x + y = [n(n+1)/2] - S > equation 2 is: x * y = N! /P > solve both we get elements > > On Fri, Jul 31, 2009 at 8:27 PM, Devi G wrote: > >> The logic is actually simple. Tot if we mark in some way an element when >> it's scanned, we can find the missing numbers in the second scannin. >> >> 3,5,1,2,9,10,8,6 >> >> When for loop sees '3' it knows elt 3 is there. So multiplies the number >> at 3rd position by some arbitrary number. (* I've taken the arbitrary >> number to be n here but CORRECT ONE IS n+3 cos n will fail in some cases* >> ) >> >> so, when it sees '5' multiplies the number at 5th position by n+3. >> It skips when the numbr is greater than n. >> >> n+3 = 11 here. >> >> So,after first loop, >> 33, 55, 11, 2 , 99, 110, 8, 66. >> >> So now, in the second scan, the indices of all elts that are divisible by >> n+3 are present in the array. >> elts at 4th and 7th positions are not divisible. hence missing numbers are >> 4 and 7. >> >> >> >> >> > > > > -- "Reduce, Reuse and Recycle" Regards, Vivek.S --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Missing numbers
@Devi; Consider this, N = 2 The array elements should these (N+2), numbers : {1, 2, 3, 4} If the given array is {4, 3} Will your code work correctly? 2009/7/31 Devi G > The logic is actually simple. Tot if we mark in some way an element when > it's scanned, we can find the missing numbers in the second scannin. > > 3,5,1,2,9,10,8,6 > > When for loop sees '3' it knows elt 3 is there. So multiplies the number at > 3rd position by some arbitrary number. (* I've taken the arbitrary number > to be n here but CORRECT ONE IS n+3 cos n will fail in some cases*) > > so, when it sees '5' multiplies the number at 5th position by n+3. > It skips when the numbr is greater than n. > > n+3 = 11 here. > > So,after first loop, > 33, 55, 11, 2 , 99, 110, 8, 66. > > So now, in the second scan, the indices of all elts that are divisible by > n+3 are present in the array. > elts at 4th and 7th positions are not divisible. hence missing numbers are > 4 and 7. > > > > > > -- "Reduce, Reuse and Recycle" Regards, Vivek.S --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Ebook needed
check these: http://avaxhome.ws/ http://www.esnips.com/ On Sat, Aug 1, 2009 at 5:20 AM, Anshya Aggarwal wrote: > *Hi, > > I need an ebook of "How to Solve It By Computer* by R. G. Dromey". If > anybody have the link or ebook please upload iht > > > -- > Anshya Aggarwal > Sent from Delhi, DL, India > > > > --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Missing numbers
check this out Let x and y be the missing number, Now equation 1 is : x + y = [n(n+1)/2] - S equation 2 is: x * y = N! /P solve both we get elements On Fri, Jul 31, 2009 at 8:27 PM, Devi G wrote: > The logic is actually simple. Tot if we mark in some way an element when > it's scanned, we can find the missing numbers in the second scannin. > > 3,5,1,2,9,10,8,6 > > When for loop sees '3' it knows elt 3 is there. So multiplies the number at > 3rd position by some arbitrary number. (* I've taken the arbitrary number > to be n here but CORRECT ONE IS n+3 cos n will fail in some cases*) > > so, when it sees '5' multiplies the number at 5th position by n+3. > It skips when the numbr is greater than n. > > n+3 = 11 here. > > So,after first loop, > 33, 55, 11, 2 , 99, 110, 8, 66. > > So now, in the second scan, the indices of all elts that are divisible by > n+3 are present in the array. > elts at 4th and 7th positions are not divisible. hence missing numbers are > 4 and 7. > > > > > > --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Missing numbers
the question can be transformed into a question in which all elements where repeated except 2 in which we used the xoring method ? comments invited.. ankur aggarwal --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Spell Checker
I have code for alternatives using tries but it is memory intensive what I understood regrading alternatives are like this if i/p is abcdefgh it will list abcd abcyu abciop abcweoiru ... something like this u will have half the word equal then it just prints those that are in the dictionary Am I right? If so the code is very simple if we use trie Arun, On Fri, Jul 31, 2009 at 7:56 PM, sharad kumar wrote: > brother how to use ternary search tree .wont there be a problem of > skewdness .how u balance height > > > On Fri, Jul 31, 2009 at 4:58 PM, Gowtham Rajappan < > gowthampsgt...@gmail.com> wrote: > >> >> On Fri, Jul 31, 2009 at 9:42 AM, Arun N wrote: >> > I think we can use a trie and search, is the word there in trie >> > but still trie eats memory . >> > >> > Arun, >> > >> > On Thu, Jul 30, 2009 at 1:45 PM, Prakhar Jain >> wrote: >> >> >> >> Hi, >> >> >> >> How would you design a dictionary so that you can make a spell checker >> ? >> >> You would have to suggest alternates... >> >> >> >> >> >> Best, >> >> Prakhar >> >> >> >> >> >> >> > >> > >> > >> > -- >> > Potential is not what U have, its what U think U have!!! >> > It is better to worn out than rust. >> > >> > >> > > >> > >> Ternary Search Tree(TST) is a good choice for spell check, dictionary. >> >> >> -- >> Gowtham R >> >> >> > > > > -- Potential is not what U have, its what U think U have!!! It is better to worn out than rust. --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Missing numbers
The logic is actually simple. Tot if we mark in some way an element when it's scanned, we can find the missing numbers in the second scannin. 3,5,1,2,9,10,8,6 When for loop sees '3' it knows elt 3 is there. So multiplies the number at 3rd position by some arbitrary number. (* I've taken the arbitrary number to be n here but CORRECT ONE IS n+3 cos n will fail in some cases*) so, when it sees '5' multiplies the number at 5th position by n+3. It skips when the numbr is greater than n. n+3 = 11 here. So,after first loop, 33, 55, 11, 2 , 99, 110, 8, 66. So now, in the second scan, the indices of all elts that are divisible by n+3 are present in the array. elts at 4th and 7th positions are not divisible. hence missing numbers are 4 and 7. --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Spell Checker
brother how to use ternary search tree .wont there be a problem of skewdness .how u balance height On Fri, Jul 31, 2009 at 4:58 PM, Gowtham Rajappan wrote: > > On Fri, Jul 31, 2009 at 9:42 AM, Arun N wrote: > > I think we can use a trie and search, is the word there in trie > > but still trie eats memory . > > > > Arun, > > > > On Thu, Jul 30, 2009 at 1:45 PM, Prakhar Jain > wrote: > >> > >> Hi, > >> > >> How would you design a dictionary so that you can make a spell checker ? > >> You would have to suggest alternates... > >> > >> > >> Best, > >> Prakhar > >> > >> > >> > > > > > > > > -- > > Potential is not what U have, its what U think U have!!! > > It is better to worn out than rust. > > > > > > > > > > Ternary Search Tree(TST) is a good choice for spell check, dictionary. > > > -- > Gowtham R > > > > --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Spell Checker
Alternatives as in alternate spelling suggestions Prakhar On Fri, Jul 31, 2009 at 7:03 PM, Vikram Sridar wrote: > Alternatives?? what way?? > > In terms of implementation or providing some other functionalities?? > > > > > --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Spell Checker
He meant alternate-spellings! Just like you get from MS-Word et. al. From: Vikram Sridar To: algogeeks@googlegroups.com Sent: Friday, 31 July, 2009 7:03:54 PM Subject: [algogeeks] Re: Spell Checker Alternatives?? what way?? In terms of implementation or providing some other functionalities?? See the Web's breaking stories, chosen by people like you. Check out Yahoo! Buzz. http://in.buzz.yahoo.com/ --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Spell Checker
Alternatives?? what way?? In terms of implementation or providing some other functionalities?? --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Spell Checker
Its not onyl about searching for the word. How would you propose alternates ? Prakhar On Fri, Jul 31, 2009 at 9:42 AM, Arun N wrote: > I think we can use a trie and search, is the word there in trie > but still trie eats memory . > > Arun, > > > On Thu, Jul 30, 2009 at 1:45 PM, Prakhar Jain wrote: > >> Hi, >> >> How would you design a dictionary so that you can make a spell checker ? >> You would have to suggest alternates... >> >> >> Best, >> Prakhar >> >> >> >> > > > -- > Potential is not what U have, its what U think U have!!! > It is better to worn out than rust. > > > > > > --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Spell Checker
On Fri, Jul 31, 2009 at 9:42 AM, Arun N wrote: > I think we can use a trie and search, is the word there in trie > but still trie eats memory . > > Arun, > > On Thu, Jul 30, 2009 at 1:45 PM, Prakhar Jain wrote: >> >> Hi, >> >> How would you design a dictionary so that you can make a spell checker ? >> You would have to suggest alternates... >> >> >> Best, >> Prakhar >> >> >> > > > > -- > Potential is not what U have, its what U think U have!!! > It is better to worn out than rust. > > > > > Ternary Search Tree(TST) is a good choice for spell check, dictionary. -- Gowtham R --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Ebook needed
try searching in these websites http://www.hongkiat.com/blog/20-best-websites-to-download-free-e-books/ On Fri, Jul 31, 2009 at 3:20 PM, Anshya Aggarwal wrote: > *Hi, > > I need an ebook of "How to Solve It By Computer* by R. G. Dromey". If > anybody have the link or ebook please upload iht > > > -- > Anshya Aggarwal > Sent from Delhi, DL, India > > > > --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Spell Checker
I think we can use a trie and search, is the word there in trie but still trie eats memory . Arun, On Thu, Jul 30, 2009 at 1:45 PM, Prakhar Jain wrote: > Hi, > > How would you design a dictionary so that you can make a spell checker ? > You would have to suggest alternates... > > > Best, > Prakhar > > > > > -- Potential is not what U have, its what U think U have!!! It is better to worn out than rust. --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Ebook needed
*Hi, I need an ebook of "How to Solve It By Computer* by R. G. Dromey". If anybody have the link or ebook please upload iht -- Anshya Aggarwal Sent from Delhi, DL, India --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---
[algogeeks] Re: Missing numbers
There is something wrong with it. I tried your code like this. int i, n = 8, a[9] = {-1,3,5,1,2,9,10,8,6}; //a[0] is never touched in the logic for(i=1; i<=n ;i++ ) //for ease of understanding starting the array with 1. { if(a[ i ] > n ) continue; else a[ a [ i ] ]*=n; } int x[2], m = 0; for ( int i = 1; i <=n ; i++) { if(a[ i ] % n == 0) continue; else { x[m++ ] = i; if(m == 2) break; } } After first for loop, the array a has -1, 3, 40, 8, 2, 72, 10, 8, 384 And finally, answer array x has 1 and 4, which is not correct. Could you elaborate your logic in pseudocode? Thanks, Channa On Thu, Jul 30, 2009 at 11:06 PM, Devi G wrote: > I'm sorry.. misunderstood the problem and tot the missin numbers are to > be less than n. > Yet it can be modified to suit the pbm. > > Suppose the two missin numbers are greater than n, then m==0 when exitin > the loop. > So they will be n+1 and n+2 only. > > in case, one of the missin numbers is greater than n, then m==1, and can be > simply found by subtracting the (array_sum+x[0] ) from (sumof 1 to n+2) > numbers. > > > On Thu, Jul 30, 2009 at 10:55 PM, Devi G wrote: > >> for(i=1; i<=n ;i++ ) //for ease of understanding starting the >> array with 1. >> { >> if(a[ i ] > n ) >> continue; >> else >> a[ a [ i ] ]*=n; >> } >> >> int x[2], m = 0; >> >> for ( int i = 1; i <=n ; i++) >> { >> if(a[ i ] % n == 0) >> continue; >> else >>{ >>x[m++ ] = i; >> if(m == 2) break; >>} >> } >> >> x[] now contain the two missing numbers in ascending order. >> > > > > > --~--~-~--~~~---~--~~ 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 options, visit this group at http://groups.google.com/group/algogeeks -~--~~~~--~~--~--~---