Results 1 to 2 of 2
  1. #1
    Predz is offline Member
    Join Date
    Dec 2009
    Rep Power

    Default uni help

    Hi, first time posting here!
    I need a little help with a uni project im currently doing.
    Usually for this sort of thing i'd ask a TA or lecturer but it being the holidays and all, the whole place is shut down and i'd like to get some work done while i have free time.

    So, what im trying to do at the moment is create a LinkedList sequence.
    Ive coded most of it by modifying an old Vector LinkedList i did but i have to implement a few new methods

    The one thats getting me currently is the replaceAtRank(int rank, object element) one.

    Im having a total mental block with it.

    I can message somebody the work ive done so far if they want to see it but its kinda too big to post here + has multiple files
    Last edited by Predz; 12-30-2009 at 07:31 PM.

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Rep Power


    Well, most linked structures use recursive methods for this type of thing. So, starting at the root node (element), dive into the next node and check it's rank. If the rank is what you're looking for, do this:
    Replace a rank 4 with this: (rank 12)
    ... --->(rank 3)--->(rank 4)--->(rank 7)--->...
    Assuming you find that the next element is rank 4 (so we are currently looking at rank 3), set the next link from our rank 12 to rank 7. Do something like: =;
    Then set the rank 3 element to point to our rank 12 element = elementWithRank12;
    Leaving you with:
    ... --->(rank 3)--->(rank 12)--->(rank 7)--->...

    Does that make any sense? Tricky to do with text, I can email you a diagram if you want.

Similar Threads

  1. calling sequence
    By rocky in forum Web Frameworks
    Replies: 0
    Last Post: 04-27-2009, 08:35 PM
  2. How to link a Array elemant to a Linked list Node
    By ravinda in forum New To Java
    Replies: 2
    Last Post: 04-18-2009, 09:16 AM
  3. linked list or array?
    By sick_peng in forum New To Java
    Replies: 6
    Last Post: 04-15-2009, 07:33 PM
  4. Fetching sequence
    By Shivraj in forum New To Java
    Replies: 1
    Last Post: 03-19-2009, 02:30 PM
  5. Escape Sequence
    By Punter in forum New To Java
    Replies: 4
    Last Post: 02-10-2009, 07:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts