*ptr1=*ptr2=string; for(i=0;i<strlen(string);i++) if(*str==' ') ptr2++; else { *ptr1=*ptr2; ptr1++; ptr2++; }
hey guys if anything wrong in this code pls let me know............ On Tue, Oct 11, 2011 at 11:04 AM, DIPANKAR DUTTA <dutta.dipanka...@gmail.com > wrote: > Solution 1: > need two scan : > > start from left and replace one by one by non-space character ( thus > have minimal replacemnt) > > count =0; > for (int i=0;i<len(str);i++) > { > if(str[i] !=NONSPCECHAR) > { str[count++]=str[i] > } > > } > > ps: any way it needs Left shift...and all solution must need left > shift if you try to compact it in lower index area. > > > > On 10/11/11, abhishek sharma <abhishek.p...@gmail.com> wrote: > > Can in place compaction be done without left shifts? > > > > > > > > -- > > Nice Day > > > > Abhishek Sharma > > Bachelor of Technology > > IIT Kanpur (2009) > > > > -- > > 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?hl=en. > > > > > > > -- > Thanks and Regards, > ------------------------------ > **DIPANKAR DUTTA > Software Development Engineer > Xen Server - OpenStack Development Team (DataCenter and Cloud) > > Citrix R&D India Pvt Ltd > 69/3, Millers Road, Bangalore – 560052 > Phone: +91 8147830733 > Office: Extn: 16429 > Email: dipankar.du...@citrix.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?hl=en. > > -- Thanks & Regards Prasad Y.Jondhale M.Tech(software engg.), Delhi College Of Engineering, Main Bawana road,Delhi-110042 Ph-09540208001 -- 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?hl=en.