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 <[email protected]>wrote: > try from back end > > surender > > > On Wed, Jul 20, 2011 at 9:54 PM, Soumya Prasad Ukil <[email protected] > > wrote: > >> Two passes over the original array is required. >> >> >> On 20 July 2011 08:10, SAMMM <[email protected]> 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 [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> 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 [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Regards, Kamakshi [email protected] -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
