Re: [algogeeks] Removing space inplace

2012-08-04 Thread atul pandey
Here.. 1. if continuous spaces are occurring even times- let 2n time then it replaces every second space with '\b'(backspace) 2. if continuous spaces are occurring even times- let 2n+1 time then for first 2n spaces it replaces every second space with '\b'(backspace) and last space gets replaced

Re: [algogeeks] Removing space inplace

2012-08-03 Thread Daksh Talwar
^ : I guess this is the only in-place method. It prevents the space from being printed. does not 'remove' it though ; just replaces with a bell sound ! On Wed, Aug 1, 2012 at 11:12 PM, atul pandey atulpande...@gmail.com wrote: Geeks just look at this...correct me if i am wrong...!! int main()

Re: [algogeeks] Removing space inplace

2012-08-02 Thread atul pandey
Geeks just look at this...correct me if i am wrong...!! int main() { char s[] = how are youfriends; int i=0; while(s[i] != '\0') { if(s[i] == ' ' s[i+1]==' ') { s[i+1] = '\b'; i++; } else if(s[i]== ' ') s[i]='\a'; i++; } printf(%s\n, s); } On Wed, Aug 1, 2012 at 5:01 PM,

Re: [algogeeks] Removing space inplace

2012-08-01 Thread dheeraj chawla
@sambhavna ...according to me u r violating the condition...bcoz using pointer u r trying to do shifting(moving) character values with spaces.so acc. to question is not correct.. On Wed, Aug 1, 2012 at 10:08 AM, Sambhavna Singh coolsambha...@gmail.comwrote: Please have a look at

Re: [algogeeks] Removing space inplace

2012-08-01 Thread Daksh Talwar
By not allowing shifting , I guess they mean that you cannot shorten the overall length of the string . Eg . ab c the output should not be obtained by shifting c to the 3rd postion in the array. On Wed, Aug 1, 2012 at 10:08 AM, Sambhavna Singh coolsambha...@gmail.comwrote: Please have a look

Re: [algogeeks] Removing space inplace

2012-08-01 Thread Sambhavna Singh
Ok thank you its much clear now :) On Wed, Aug 1, 2012 at 1:40 PM, Daksh Talwar dakshtal...@gmail.com wrote: By not allowing shifting , I guess they mean that you cannot shorten the overall length of the string . Eg . ab c the output should not be obtained by shifting c to the 3rd postion

Re: [algogeeks] Removing space inplace

2012-08-01 Thread atul anand
j=0; for i to len if(str[i] != ' ' ) { str[j]=str[i]; j++; } end str[j]='\0'; On Wed, Aug 1, 2012 at 10:08 AM, Sambhavna Singh coolsambha...@gmail.comwrote: Please have a look at this :

[algogeeks] Removing space inplace

2012-07-31 Thread Sambhavna Singh
Please have a look at this : http://www.careercup.com/question?id=14433699utm_source=feedburnerutm_medium=emailutm_campaign=Feed%3A+Careercup+%28CareerCup%29 What does inplace shifting imply here? Cant i keep 2 pointers and overwrite a non space character onto a space character and advance both