Hi,
I'm trying to create 2 linked list with a common intersection node. As I see this is a very hot question in LinkedList to find the intersection node. I have written following code but it throws InvalidOperationexception.
LinkedList<int> LL = new LinkedList<int>();
LL.AddFirst(5);
LL.AddFirst(4);
LL.AddFirst(3);
LL.AddFirst(2);
LL.AddFirst(1);
LinkedListNode<int> sectionNode = LL.Find(3);
LinkedList<int> LL2 = new LinkedList<int>();
LL2.AddFirst(100);
LL2.AddFirst(90);
LL2.AddFirst(80);
LL2.AddFirst(sectionNode);
Could someone please guide me how I can create a Y shaped linked list in C#.