Results 1 to 3 of 3

Thread: [2005] Question about LinkedList

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2005
    Location
    UK
    Posts
    87

    [2005] Question about LinkedList

    I use got 2 LinkedListNode P1 and P2 from a LinkedList

    I wonder is there a way to know the order of these two.

    P1 is behind of P2 or the other way round.

    Thanks

  2. #2
    Hyperactive Member The_Duck's Avatar
    Join Date
    May 2005
    Location
    Leamington, UK
    Posts
    351

    Re: [2005] Question about LinkedList

    Linked Lists! Long time since Ive used one of them!! (ADA95!!)

    Anyway,

    The whole point of a linked list is that you have the items, linked, in an order. So you can tell the order, as you will have as structure like

    RootNode -> Node1 -> Node2

    (This is in the most basic linked list environment)

  3. #3
    Hyperactive Member The_Duck's Avatar
    Join Date
    May 2005
    Location
    Leamington, UK
    Posts
    351

    Re: [2005] Question about LinkedList

    VB Code:
    1. Dim List As New System.Collections.Generic.LinkedList(Of Integer)
    2. List.AddAfter(List.AddAfter(List.AddFirst(1), 2), 3)
    3. System.Windows.Forms.MessageBox.Show(List.First.Next.Previous.Value.ToString)

    This is some simple code that illustrates the point. List.First gets you the first item on the list. From any Node you can then either do a .Previous or .Next

Posting Permissions

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



Click Here to Expand Forum to Full Width