|
-
Jun 22nd, 2006, 10:47 AM
#1
Thread Starter
Lively Member
[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
-
Jun 22nd, 2006, 01:48 PM
#2
Hyperactive Member
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)
-
Jun 22nd, 2006, 02:00 PM
#3
Hyperactive Member
Re: [2005] Question about LinkedList
VB Code:
Dim List As New System.Collections.Generic.LinkedList(Of Integer)
List.AddAfter(List.AddAfter(List.AddFirst(1), 2), 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|