+1(978)310-4246 credencewriters@gmail.com
  

Question Description

I’m studying and need help with a C++ question to help me learn.

Using the linked list implementation posted on the link, please complete the following methods:

the instruction will be uploaded in the pictures

https://learn-us-east-1-prod-fleet01-xythos.conten…

Remove duplicates from a sorted linked list
• Compare the current node with the next nodes (adjacent nodes).
• If current and current next have the same data value, then
• Create a temp node for the next of next node.
• Remove the node.
• Set the next of current node to temp node.
Else
• Keep iterating the list.
data next
42
data next
50
data next
50
data next
50
data next
60
data next
60 pull
Remove duplicates from an unsorted linked list V1
• Create two pointers to store the current, and the runner
• The runner pointer points the current next
• Iterate the list with the runner pointer
• If current data is same as runner data, then
Call RemoveNode with the current node and the runner node.
Set the runner to runner next.
• Set the current to current next.
data next
data next
data next
data next
42
data next
50
19
42 –
data next
9 nulll
50 C
Set the runner to runner next.
• Set the current to current next.
data next
data next
data next
42
data next
50
data next
42
data next
9 null
19
50
Remove duplicates from an unsorted linked list V2
.
.
• Create three pointers to store the current, runner, and duplicate
The runner pointer points the current
• Iterate the list with the runner pointer
If current data is same as runner next data, then
• Store the runner next node in duplicate pointer
• Set runner next to the next of the runner next node.
• Remove the node via duplicate pointer.
• Else, set the runner to runner next.
data next
data next
42
data next
50
data next
42
data next
50
data next
9 null
19
Please submit your source code to your BitBucket repository csci221-HW03. Make sure that
there is no memory leak when these duplicates are removed.

Purchase answer to see full
attachment

  
error: Content is protected !!