Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!

Helen Morgan

Greenhorn
+ Follow
since Apr 16, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Helen Morgan

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?



Not sure how to edit post.  
But what i am trying to do is what i have inputted originally, (arrlst) - selection sort that string after the bubblesort output. I don't know if i am explaining it right.

1 year ago


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!  

1 year ago
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!  

1 year ago

Norm Radder wrote:

still doesnt bubblesort the words


What is wrong with the output you posted?  It looks like the words are in order.


i just redid and typed them and it doesnt reorder.  

Please enter words, or done to stop
cat
zebra
dog
snake
done
The list contains:
cat
zebra
dog
snake
BubbleSort:  



1 year ago

Campbell Ritchie wrote:

Carey Brown wrote:. . . Shouldn't that be words.length?

And it shouldn't be accompanied by the <= sign.

. . . 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.



Thank you!!
1 year ago
OK i fixed it a little more! It compiles but still doesnt bubblesort the words i input?
This is the output

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)




1 year ago
Good morning! I am working on my very last assignment for my Java programming class.  This is my last assignment that determines whether i get my Associates Degree.  I have already passed my Proctor Exam. I am just caught on this assignment.  I have the first half done and have started on the Bubblesort section (doing one at a time to make sure they are right).  I am just having trouble figuring out what i am doing wrong.  The assignment so to user input words til you type done and it will deplay. (which i have), then bubblesort those words and display and then same with selection sort.
Any help would be great!  I am just at my wits end....


Thank you so much for listening to the rabbling!
1 year ago