Java program to sort strings using bubble sort




















Writing code in comment? Please use ide. Load Comments. What's New. Most popular in Sorting. More related articles in Sorting. Segregate 0s and 1s in an array Sort all even numbers in ascending order and then sort all odd numbers in descending order Comparison among Bubble Sort, Selection Sort and Insertion Sort Python Sort a list according to the second element in sublist Iterative Merge Sort.

We use cookies to ensure you have the best browsing experience on our website. Start Your Coding Journey Now! I've been trying to tackle this bug for a while, but I can't get around to it.

The purpose of the program below is to use bubble sort to alphabetically order an array of names. The main challenge I am having is comparing any 2 strings past name. If I only compare the characters of any 2 strings at 1 specific index point, my code works.

However, if I try to make the comparison move past index 0 if index 0 of both strings are equal to each other, my program no longer works. If I simply default the min value to 1, the code runs and does its intended job. However, if the min value stays dynamic, the program does not work. I'm trying to discern why this is so and what the fix is. Any help would be appreciated! Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 1 year, 7 months ago. Active 1 year, 7 months ago. Angular 7. Machine Learning. Data Structures. Operating System. Computer Network. Compiler Design. Computer Organization. Discrete Mathematics. Ethical Hacking. Computer Graphics. Software Engineering. Web Technology. Cyber Security. C Programming.



0コメント

  • 1000 / 1000