# Anagram Bubble Sorter [closed]

The Challenge

A bubble sort takes a list of non-repeating integers and sorts them in ascending order, with only the use of one operation: switching two numbers which are next to eachother.

However for this puzzle, you must take in two strings, which are both anagrams, and bubble sort the letters of the first string into the second.

Example:

Trap, Part

TRAP TRPA TPRA PTRA PTAR PATR PART

Rules

• Your program must only use the switching operation
• Your program must use the most optimal way of bubble sorting
• This is code golf, lowest amount of bytes wins!

## closed as unclear what you're asking by Geobits, Reto Koradi, Downgoat, PurkkaKoodari, Peter TaylorOct 19 '15 at 6:31

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Could you provide examples? – Addison Crump Oct 19 '15 at 2:11
• do we have to print each step? – Maltysen Oct 19 '15 at 2:28
• @maltysen no, as long as you follow the rules provided its ok. – Meow Mix Oct 19 '15 at 2:31
• Can you elaborate on the sort algorithm used? In most bubble sorts I've seen, the example's T would quickly bubble down and the P would take longer to get in position. Here it seems to be the opposite. – Geobits Oct 19 '15 at 2:33
• If I understand your intentions, you want us to modify an array of letters in place using only swaps, using the minimum amount of swaps. I'm not sure how much sense this makes since a) Strings are immutable in many languages, so they can't be modified at all. b) That not at all what bubble sort does. Bubble sort is not about finding a minimum number of swaps, but about iterating over a list and conditionally swapping two adjacent elements if they're out of order. – Dennis Oct 19 '15 at 3:12