Jump to content

Java Arraylist


Recommended Posts

How would you sort in ascending order an arraylist in java. In other words. You have an arraylist (list1) nwith random values, how would you put those values in ascending order in a second arraylist(list2)?

I have all the code, but I can get that part working, it is a logic error. Help please

Link to comment
Share on other sites

I forgot to mentiones. I am not allowed to use any sorting method, such as sort, bubble sort, binary sort, etc. I pretty much have to compare each element in the array and put it in their correct place. I have spend 2 hours trying to figure it out and still can't get it to work.

Link to comment
Share on other sites


I just took a course in Java programming at University, and at the same time we discussed the sorting algorithms in Math, Big O, Small O and so on, for all Mathematicians out there. ;)

I think your assignment is to Write a sorting algorithm without using already implemented functions.

I'd say, try to program one of the easier sorting algorithms, you can find tutorials on them out there as well.

I'd recommend looking at wikipedia, they usually have pseudocode aswell.

Hmmm if you need help programming the stuff, just send me a pm or write it in here.

I'm glad to help ;)

PS: Sorting is always an algorithm of some sort to be precise.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...