I am just having trouble figuring out what i am doing wrong.
And it shouldn't be accompanied by the <= sign.Carey Brown wrote:. . . Shouldn't that be words.length?
Please enter words, or done to stop
apple
car
cat
og
done
The list contains:
apple
car
cat
og
BubbleSort):
BUILD SUCCESSFUL (total time: 15 seconds)
Campbell Ritchie wrote:
And it shouldn't be accompanied by the <= sign.Carey Brown wrote:. . . Shouldn't that be words.length?
. . . and welcome to the Ranch
I think you should start with a method that swaps two elements in an array. You can reuse that method as often as you like.
still doesnt bubblesort the words
Norm Radder wrote:
still doesnt bubblesort the words
What is wrong with the output you posted? It looks like the words are in order.
Please enter words, or done to stop
cat
zebra
dog
snake
done
The list contains:
cat
zebra
dog
snake
BubbleSort:
How do you know that?it doesnt reorder.
BubbleSort:
This is what i need to do - hope this helps
Write console program that repeatedly prompts the user to enter data until they type done
(any case, Upper, Lower, or Mixed). As they enter the data, assign it to a two-dimension array
where the first dimension contains exactly what they type and the second dimension contains
the first non-whitespace character of what they type, in lowercase. If they enter a blank line, it
is acceptable to skip that line. When they type done, do these steps:
1. display: As Entered - Done
2. for each entry in the array, display the index of the first dimension, the second
dimension's value, and the first dimension's value on a single line separated by :
(colon). Done
3. display: Bubble Sorted - Done
4. using a bubble sort, for each entry in the array, display the original index of the first
dimension, the second dimension's value, and the first dimension's value on a single
line separated by : (colon) sorted by the second dimension. Done
5. display: Selection Sorted - This is where i am kind of stuck
6. using a selection sort, for each entry in the array, display the original index of the first
dimension, the second dimension's value, and the first dimension's value on a single
line separated by : (colon) sorted by the first dimension.
Helen Morgan wrote:Afternoon! I finally got the Bubblesort fixed and working, Now i cant figure out what i have going on with the Selection Sort.....I probably am doing it wrong? What am i doing wrong?
and again i greatly appreciate this!
Norm Radder wrote:What is the logic for the selection sort? Can you add it as comments in the code so anyone reading the code can see if the code is following the logic shown in the comments?
selection sort that string
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |