Updated Linked List and updated

This commit is contained in:
2022-03-04 16:58:31 +00:00
parent 8165bb849b
commit 00f52ee5c7
5 changed files with 78 additions and 68 deletions

View 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; }
}
}

View 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
};
}
}
}

View File

@ -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
};
}
}
}