first count the no of elements to be printed say it is 'n'. now start from n-1 and start expanding the array from right to left..
On Wed, Jul 20, 2011 at 10:56 PM, surender sanke <surend...@gmail.com>wrote: > try from back end > > surender > > > On Wed, Jul 20, 2011 at 9:54 PM, Soumya Prasad Ukil <ukil.sou...@gmail.com > > wrote: > >> Two passes over the original array is required. >> >> >> On 20 July 2011 08:10, SAMMM <somnath.nit...@gmail.com> wrote: >> >>> You can do it using stack concept:-- >>> >>> Pop the element from the end , taking two variable index1, index2 and >>> Ch(character to Iterate) >>> >>> Eg:- a1b4 .... here index1=4 , Ch='b', index2=1; >>> >>> Start filling the element of Ch from the extreme end of the array .. >>> From right hand side . >>> >>> The array will look like this :- >>> >>> a b b b b >>> >>> In next iteration : Index1=index2,ch=a, index= no value( Underflow) >>> >>> repeat the same process giving:- >>> >>> a b b b b. (soln). >>> >>> >>> Add element at the end .. Like character 'b' is added from the Right >>> hand end of the array . >>> >>> >>> If any bug in my approach ... comments me ... >>> >>> >>> -- >>> 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. >>> >>> >> >> >> -- >> regards, >> soumya prasad ukil >> >> -- >> 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. >> > > -- > 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. > -- Regards, Kamakshi kamakshi...@gmail.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.