Welcome to Discuss Everything Forums...

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.


 

Your Message

Click here to log in

What comes after M0nday

 
 

You may choose an icon for your message from this list

Additional Options

  • Will turn www.example.com into [URL]http://www.example.com[/URL].

Rate Thread

You may rate this thread from 1-star (Terrible) to 5-stars (Excellent) if you wish to do so.

Topic Review (Newest First)

  • 03-02-2011, 04:53 AM
    Progun

    (JAVA) What is the most efficient way to find an element in a linked list where its...

    ...node is empty? Basically, lets say you have a linked list of 10 elements where they look something like:

    listA.add(1);
    listA.add(2);
    listA.add(3);
    listA.add(null);
    listA.add(5);
    listA.add(6);
    listA.add(7);
    listA.add(8);
    listA.add(9);

    therefore contains 10 elements, but the 4th element contains a null value. What is the most EFFICIENT way to find the node that contains the null value without iterating through the whole linked list?

    Info: Linked list is not necessarily sorted, and even though the node contains a null value, it still exists therefore its still pointing to the next item in the list.

    Thanks

Posting Permissions

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