Great explanation Sunny. But with this approach, won't a single pass suffice?
Select a card , find it's new position, insert the card at that position, initialize i to the position of the replaced card repeat till all cards have been processed. The thing we need to remember is whether relative to the new position of the current card, the previous insertion was before or after the newly computed position. Please comment. On Oct 16, 3:36 am, sravanreddy001 <[email protected]> wrote: > cheers.. > clear explanation. thanks for the effort.. :) > > so.. we swap 3 elements and.. run for one complete cycle of N/3 time in > this prob.. > > Anika has a recusion of N/3 depth.. may be.. a loop that runs N/3 time > should suffice. > > :) -- 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.
