Question
Need help finishing this doubly linked list code. Commented lines are what's needed, also add the following recursive methods: findFirstNodeWithValue() and getDisplayString() that returns a
Need help finishing this doubly linked list code.
Commented lines are what's needed, also add the following recursive methods: findFirstNodeWithValue() and getDisplayString() that returns a string containing the strings in the list separated by spaces
Code in C# language only, please.
internal class DoubleLinkedList { public DoubleLinkedListNode? firstNode = null; public DoubleLinkedListNode? lastNode = null; public DoubleLinkedListNode? currentNode = null; // other class level variables needed?
public DoubleLinkedList() { // creates first node in list with firstValue }
public DoubleLinkedList(string firstValue) { // methods and features to add: // get current node reference // insert node before first // delete first node // insert node after last // delete last node // insert node after current - uses multiple methods // delete current // move current to next node // move current to previous node // recursive: find node with value - return reference or null // recursive: get display string } }
/******************************* * double Linked List Node - needs to be made generic * class is incomplete * *****************************/ internal class DoubleLinkedListNode { public string? value = null; public DoubleLinkedListNode? nextNode = null; public DoubleLinkedListNode? previousNode = null; public DoubleLinkedListNode(string v) { value = v.ToLower(); }
private DoubleLinkedListNode() { value = null; } }
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