I have created the following LinkedList code with many features. It is available to the public through the CodeBase github public repository .
Classes: Node and LinkedList
Getters and Setters: First and Last
Functions : AddFirst(data), AddFirst(node), AddLast(data), RemoveLast(), AddAfter(node, data), RemoveBefore(node), Find(node), Remove(foundNode), Print(LinkedList)
using System; using System.Collections.Generic; namespace Codebase { public class Node { public object Data { get; set; } public Node Next { get; set; } public Node() { } public Node(object Data, Node Next = null) { this.Data = Data; this.Next = Next; } } public class LinkedList { private Node Head; public Node First { get => Head; set { First.Data = value.Data; First.Next = value.Next; } } public Node Last { get { Node p = Head;
Using @yogihosting's answer when she used the built-in Microsoft LinkedList and LinkedListNode to answer the question, you can achieve the same results:
using System; using System.Collections.Generic; using Codebase; namespace Cmd { static class Program { static void Main(string[] args) { var tune = new LinkedList();
Shadi Namrouti Feb 18 '19 at 10:27 2019-02-18 10:27
source share