Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Java The sorting method below feels very arbitrary. I've tried values to understand it but am still Confused. Any help/tips will be appreciated.

Codestudent121

New Coder
The method below is intended to use an insertion sort. For example: if I had a String ArrayList of elements ("code", "computer", "area", "school"), it should sort the elements by insertion sort. I'm having a hard time understanding the logic, and have watched many videos.

Screenshot 2021-04-24 10.33.48 AM.png
 
Hi there! Welcome to Code Forum!

So right off the bat I just want to say I'm not too familiar with Java but I'll try my best to help. My understanding from what you described is that you are trying to sort a string array by insertion sort. I can certainly recognize that understanding this function can be of great value and can be useful in future projects. With that we'd be happy to help you out with this.

First I highly recommend that you copy the code and paste it in our </> formatting to help display the code better and gives us the ability to copy and paste it in our editors.

Now let's see if we have a few coders who can help! @Hassapiko @Krusty the Senile @Mutiny any thoughts?
 
The method below is intended to use an insertion sort. For example: if I had a String ArrayList of elements ("code", "computer", "area", "school"), it should sort the elements by insertion sort. I'm having a hard time understanding the logic, and have watched many videos.

Hi there! not sure if you came across this already or not, but this video here helped me a ton trying to understand sorting in Java when I first started out coding...maybe it can help you understand too! The video goes through most of the sorting algorithms, insertion sort is towards the end.
insertion sort timestamp: 19:10
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom