I need help trying to figure out how to insert into a multi linked list. I know how it works with a linked list with only one piece of data but not 2 pieces with 2 pointers. Essentially what I want to be able to do is creat a multi linked list where each node stores x and y co ordinate values and I also want to be able to find the midpoint of 2 nodes and insert that into the list. Thanks in advance!

Recommended Answers

All 3 Replies

Links like previous and next are used for doubly linked lists, which are easy to search forward and backward from a given node in the list.

Links like rightChild and leftChild are used to create binary trees, which can improve search times compared with linked lists.

Both lists and trees can contain more than one piece of data.

Keeping track of which two nodes you want to use to get a midpoint is possibly with either structure, but inserting between adjacent nodes is more stratightforward with a linked list.

I'm sorry I just tried to share what I have. Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.