0

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!

3
Contributors
3
Replies
10
Views
5 Years
Discussion Span
Last Post by rioeduardo
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.