152k views
1 vote
I couldn't understand this algorithm. Please help me to do this.​

I couldn't understand this algorithm. Please help me to do this.​-example-1
User Leidolf
by
8.1k points

1 Answer

3 votes

Answer:

This is bubble sort, to alphabetize an array of strings.

Step-by-step explanation:

The algorithm walks through the array, and compares one value to the next. If the 'current' value is larger than the next, it swaps them, and starts all over.

So a value that lexographically is first to be alphabetized, will 'bubble' all the way to the top.

User Hakan Baba
by
8.2k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.