Updated Linked List and updated
This commit is contained in:
13
C#/Datastructures/Nodes/INode.cs
Normal file
13
C#/Datastructures/Nodes/INode.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace C_.Datastructures.Nodes
|
||||
{
|
||||
public interface INode<T>
|
||||
{
|
||||
public T? Value { get; set; }
|
||||
public INode<T>? Next { get; set; }
|
||||
}
|
||||
}
|
23
C#/Datastructures/Nodes/LinkedListNode.cs
Normal file
23
C#/Datastructures/Nodes/LinkedListNode.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace C_.Datastructures.Nodes
|
||||
{
|
||||
internal class LinkedListNode<T> : INode<T>
|
||||
{
|
||||
public T? Value { get; set; } = default;
|
||||
public INode<T>? Next { get; set; } = default(LinkedListNode<T>);
|
||||
|
||||
public static LinkedListNode<T> Create(T? value, LinkedListNode<T>? next)
|
||||
{
|
||||
return new LinkedListNode<T>
|
||||
{
|
||||
Value = value,
|
||||
Next = next
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace C_.Datastructures.Nodes
|
||||
{
|
||||
public interface iNode<T>
|
||||
{
|
||||
public T? Value { get; set; }
|
||||
public iNode<T>? Next { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class Node<T> : iNode<T>{
|
||||
public T? Value { get; set; } = default(T);
|
||||
public iNode<T>? Next { get; set; } = default(Node<T>);
|
||||
|
||||
public static Node<T> Create(T? value, Node<T>? next){
|
||||
return new Node<T>{
|
||||
Value = value,
|
||||
Next = next
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user