Added Doubly Linked List Node
This commit is contained in:
parent
fffce6c6bb
commit
80bb1cc492
@ -5,9 +5,9 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace C_.Datastructures.Nodes
|
||||
{
|
||||
public interface ILinkedListNode<T>
|
||||
public interface INode<T>
|
||||
{
|
||||
public T? Value { get; set; }
|
||||
public ILinkedListNode<T>? Next { get; set; }
|
||||
public INode<T>? Next { get; set; }
|
||||
}
|
||||
}
|
26
C#/Datastructures/Nodes/LinkedList/DoublyLinkedListNode.cs
Normal file
26
C#/Datastructures/Nodes/LinkedList/DoublyLinkedListNode.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace C_.Datastructures.Nodes.LinkedList
|
||||
{
|
||||
internal class DoublyLinkedListNode<T> : INode<T>
|
||||
{
|
||||
public T? Value { get; set; } = default;
|
||||
public INode<T>? Next { get; set; } = default(DoublyLinkedListNode<T>);
|
||||
|
||||
public INode<T>? Prev { get; set; } = default(DoublyLinkedListNode<T>);
|
||||
|
||||
public static DoublyLinkedListNode<T> Create(T? value, DoublyLinkedListNode<T>? next, DoublyLinkedListNode<T> prev)
|
||||
{
|
||||
return new DoublyLinkedListNode<T>
|
||||
{
|
||||
Value = value,
|
||||
Next = next,
|
||||
Prev = prev
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -4,12 +4,12 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace C_.Datastructures.Nodes
|
||||
namespace C_.Datastructures.Nodes.LinkedList
|
||||
{
|
||||
internal class LinkedListNode<T> : ILinkedListNode<T>
|
||||
internal class LinkedListNode<T> : INode<T>
|
||||
{
|
||||
public T? Value { get; set; } = default;
|
||||
public ILinkedListNode<T>? Next { get; set; } = default(LinkedListNode<T>);
|
||||
public INode<T>? Next { get; set; } = default(LinkedListNode<T>);
|
||||
|
||||
public static LinkedListNode<T> Create(T? value, LinkedListNode<T>? next)
|
||||
{
|
Loading…
Reference in New Issue
Block a user