Search:

Type: Posts; User: wdh

Search: Search took 0.15 seconds.

  1. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    Sorted! seems so simple now, i now re set the iterator and it runs back through the list until sorted.
    Thanks for all the help Norm.
  2. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    I had another look, ive found circular linked lists which points the last node to the first so it keeps running through, that would help me to keep running through the list but in my head i imagine...
  3. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    Sorry, dont understand what you are saying . . .
  4. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    Currently its the same as below. If the current date is before previous then sorted = false. It still only runs through the list once though, im not sure how to get it to run through until all...
  5. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    Im still not sure how to get this to loop through again. I set the boolean sorted to false if the if statement comparing the dates is true. I also have to set the boolean sorted to true at some point...
  6. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    Ive added a temporary assignment to hold the previous element, and them im setting that element at the current index. Ive updated my code at the top of this page, the output shows that its working...
  7. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    Thank you, that makes it clearer. So im setting the previous index to the correct date, but them im setting the current index to the same as the previous.
  8. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    in orderSort()
    date - is the previous date in the list
    dateCheck - is the current date in the list
    so dateCheck should be the date the iterator is currently on and it checks to see if it is...
  9. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    Sorry its a bit of a mess, i usually seperate them into seperate files. It compiles and runs in the same way as before though.



    import java.text.ParseException;
    import...
  10. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    I realised i hadnt assigned anything to the boolean sorted so it would never break and print the assignmentList. Changed that now and the printed assignmentList is very wrong. I just have two of...
  11. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    I think its going someway to sorting the list, i changed firstIndex = assignmentList.indexOf(iterator.previous());
    to firstIndex = iterator.previousIndex(); and i now get some output using the new...
  12. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    Ive found the infinite loop is while(iterator.hasNext())
    Ive also put a println statement in before i check the dates and both dates are the same, both dates are always set to the first date in the...
  13. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    When i run it in my tester, it goes through the rest of my methods but when it gets to this nothing happens. It still says the program is running so i put a println statement in the while loop and...
  14. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Re: Sorting LinkedList

    At the moment this code is doing nothing. I can explain what i am trying to do with it though
    While there is another element in the list, i store the index of the previous element, as well as get...
  15. Thread: Sorting LinkedList

    by wdh
    Replies
    28
    Views
    3,843

    [SOLVED] Sorting LinkedList

    Im trying to do a bubble sort style process to my linkedList. It is a LinkedList of assignments, each with a set date stored as a string. I want to order the linkeList by the the date in which they...
Results 1 to 15 of 15