Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Insert Do not be afraid to diagram this! Dynamically allocate a Node and insert it in front of the position of the passed - in
Insert
Do not be afraid to diagram this!
Dynamically allocate a Node and insert it in front of the position of the passedin
Iterator
There are three special cases for this method, depending on what the Iterator is storing
o Empty List
Iterator will be storing a null pointer, so the list needs to be started
Theres a method to help with this
o Head
Iterator will be storing a pointer to the head of the list
Theres a method to help with this
o Anywhere else
Iterator is storing a pointer to another node even the tail
Link the nodes before and after the inserted nodes
This will require setting a total of four nextprev pointers
In all cases, the passedin Iterator should be updated to store the newly inserted node
C
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started