[algogeeks] Re: DS QUESTION

2011-09-18 Thread wasim
2n!/n!(n+1)! catalan number also asked by directi in written ... wasim akram MCA 3rd year -- 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

[algogeeks] Re: DS question

2009-10-13 Thread Raghavendra Sharma
@Debanjan Thanks for correcting this. On Tue, Oct 13, 2009 at 5:12 PM, Debanjan wrote: > > On Oct 13, 12:05 pm, Raghavendra Sharma > wrote: > > For the first problem. > > > > All occurrence of a duplicate character in a word. > > > > void RemoveDuplicates(char *word) { > > int count[256] = {0

[algogeeks] Re: DS question

2009-10-13 Thread Debanjan
On Sep 8, 10:47 am, yash wrote: > wap a program in efficient manner to remove all occurrence of > duplicate character in the word and all occurrence of duplicate word > in the file. > > i break the problem in two section( this is my approach it may be > better one ) > > wap to remove all duplicat

[algogeeks] Re: DS question

2009-10-13 Thread Debanjan
On Sep 8, 10:47 am, yash wrote: > wap a program in efficient manner to remove all occurrence of > duplicate character in the word and all occurrence of duplicate word > in the file. > > i break the problem in two section( this is my approach it may be > better one ) > > wap to remove all duplicat

[algogeeks] Re: DS question

2009-10-13 Thread Debanjan
On Oct 13, 12:05 pm, Raghavendra Sharma wrote: > For the first problem. > > All occurrence of a duplicate character in a word. > > void RemoveDuplicates(char *word) { >   int count[256] = {0, 0}; >   char *p = word; > >   while ( p ) { This would be while(*p) { >     count[(int)(*p)] = 1; >    

[algogeeks] Re: DS question

2009-10-13 Thread Debanjan
OOPS sorry the code is not correct. --~--~-~--~~~---~--~~ 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

[algogeeks] Re: DS question

2009-10-13 Thread Raghavendra Sharma
For the first problem. All occurrence of a duplicate character in a word. void RemoveDuplicates(char *word) { int count[256] = {0, 0}; char *p = word; while ( p ) { count[(int)(*p)] = 1; p++; } p = word; char *q = word; while ( q ) { if ( count[*q] ) { *p = *q;

[algogeeks] Re: DS question

2009-09-08 Thread Matic Potočnik
Hashing for words, and a mapping to ASCII values for characters (make array of size 256... if (A[(int)string[i]] == 0), an original char, A[(int)string[i]] ++, else a duplicate char) Go through string and delete duplicate chars and when you reach the end of a word hash it and add it to output if

[algogeeks] Re: DS question

2009-09-08 Thread Bharath
You can use a hash map. What do u mean by preserving order? Keep inserting the characters into hash, whenever u find a duplicate, delete it. The order is maintained still. Can you please elaborate on what is mean by preserving order? On Sep 8, 10:47 am, yash wrote: > wap a program in efficient