Separeted Generic Nodes (Directed and Undirected)
This commit is contained in:
parent
e5fa390608
commit
78df73e66d
@ -2,7 +2,7 @@
|
||||
|
||||
namespace C_.Datastructures.DoublyLinkedList
|
||||
{
|
||||
internal class DoublyLinkedListNode<T> : Node<T, DoublyLinkedListNode<T>>
|
||||
internal class DoublyLinkedListNode<T> : UndirectedNode<T, DoublyLinkedListNode<T>>
|
||||
{//Inherits from Node
|
||||
public DoublyLinkedListNode<T>? Prev { get; set; } = default;
|
||||
|
||||
|
15
C#/Datastructures/Generic/DirectedNode.cs
Normal file
15
C#/Datastructures/Generic/DirectedNode.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace C_.Datastructures.Generic
|
||||
{
|
||||
internal class DirectedNode<T, NodeType>
|
||||
{
|
||||
public T? Value { get; set; } = default;
|
||||
public NodeType? Left { get; set; } = default;
|
||||
public NodeType? Right { get; set; } = default;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
namespace C_.Datastructures.Generic
|
||||
{
|
||||
internal class Node<T, NodeType>
|
||||
internal class UndirectedNode<T, NodeType>
|
||||
{//Generic Node type that every other type inherits from
|
||||
public T? Value { get; set; } = default;
|
||||
public NodeType? Next { get; set; } = default;
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace C_.Datastructures.LinkedList
|
||||
{
|
||||
internal class LinkedListNode<T> : Node<T, LinkedListNode<T>>
|
||||
internal class LinkedListNode<T> : UndirectedNode<T, LinkedListNode<T>>
|
||||
{//Inherits from Node
|
||||
public static LinkedListNode<T> Create(T? value, LinkedListNode<T>? next)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace C_.Datastructures.Queue
|
||||
{
|
||||
internal class QueueNode<T> : Node<T, QueueNode<T>>
|
||||
internal class QueueNode<T> : UndirectedNode<T, QueueNode<T>>
|
||||
{
|
||||
public static QueueNode<T> Create(T? value, QueueNode<T>? next)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ using C_.Datastructures.Generic;
|
||||
|
||||
namespace C_.Datastructures.Stack
|
||||
{
|
||||
internal class StackNode<T> : Node<T, StackNode<T>>
|
||||
internal class StackNode<T> : UndirectedNode<T, StackNode<T>>
|
||||
{//Inherits from Node
|
||||
public static StackNode<T> Create(T? value, StackNode<T>? next)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user