2022-03-26 22:38:49 +00:00
|
|
|
using C_.Datastructures.Nodes;
|
|
|
|
|
|
|
|
namespace C_.Datastructures
|
|
|
|
{
|
|
|
|
internal class Stack<T>
|
|
|
|
{
|
|
|
|
public StackNode<T>? Head { get; set; }
|
2022-03-28 21:41:24 +00:00
|
|
|
private int Count { get; set; } = 0;
|
2022-03-26 22:38:49 +00:00
|
|
|
|
|
|
|
public Stack<T> Create(){
|
|
|
|
//Create a new stack without a head
|
2022-03-28 21:41:24 +00:00
|
|
|
return new Stack<T>();
|
2022-03-26 22:38:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public Stack<T> Create(T value){
|
|
|
|
//Create a new Stack with a head
|
|
|
|
return new Stack<T>{
|
2022-03-28 21:41:24 +00:00
|
|
|
Head = StackNode<T>.Create(value, default),
|
2022-03-26 22:38:49 +00:00
|
|
|
Count = 1
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|