Question: using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace Homework { public class LinkNode : IEnumerable { public LinkNode(T
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections;
namespace Homework { public class LinkNode : IEnumerable { public LinkNode(T value = default(T), LinkNode next = null, LinkNode previous = null) { Value = value; Next = next; Previous = previous;
if (Next != null) Next.Previous = this; if (Previous != null) Previous.Next = this; } public T Value { get; protected set; } public LinkNode Next { get; protected set; } public LinkNode Previous { get; protected set; }
#region helper functions LinkNode WalkToTail() { LinkNode node = this; while (node.Next != null) { node = node.Next; } return node; }
LinkNode WalkToHead() { LinkNode node = this; while (node.Previous != null) { node = node.Previous; } return node; }
LinkNode CreateNodeFor(T value, LinkNode next = null, LinkNode previous = null) { LinkNode node = new LinkNode(value, next, previous); return node; } #endregion Helper Functions
public LinkNode Find(T match) { //TODO: // Ability to find an element in the list // If it doesnt exist, return null.
} }
In C# Please code ONLY the find function. This is a program for a doubly linked list. Included helper functions.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
