Hi, U can do this by decreasing priority after printing the element.
U can choose any criterion to pick element at same priority level. I picked the lexiographic order. the resulting sequence is A B A B C D A B C D E --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups-beta.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---