Cleaned up various DataStructures
This commit is contained in:
parent
a8d47f1061
commit
c7ccd641c4
@ -196,7 +196,7 @@ namespace C_.Datastructures.BinaryTree
|
||||
|
||||
|
||||
|
||||
private TreeNode<T>? GetNext(T value, TreeNode<T>? node)
|
||||
private static TreeNode<T>? GetNext(T value, TreeNode<T>? node)
|
||||
{//T is comparable so use methods to determine which way to traverse
|
||||
if(node == default)
|
||||
return default;
|
||||
@ -214,8 +214,6 @@ namespace C_.Datastructures.BinaryTree
|
||||
if (Root == default || Root.Value!.Equals(default))
|
||||
return default;
|
||||
|
||||
TreeNode<T>? current = Root;
|
||||
|
||||
Stack<TreeNode<T>>? stack = Stack<TreeNode<T>>.Create(Root);
|
||||
|
||||
while (stack.Peek() != default)
|
||||
@ -229,7 +227,7 @@ namespace C_.Datastructures.BinaryTree
|
||||
return default;
|
||||
}
|
||||
|
||||
private Stack<TreeNode<T>>? Min(TreeNode<T>? node)
|
||||
private static Stack<TreeNode<T>>? Min(TreeNode<T>? node)
|
||||
{//Returns a Stack with the value on top being the minimum of the subtree
|
||||
|
||||
if(node == default)
|
||||
@ -246,7 +244,7 @@ namespace C_.Datastructures.BinaryTree
|
||||
}
|
||||
}
|
||||
|
||||
private Stack<TreeNode<T>>? Max(TreeNode<T>? node)
|
||||
private static Stack<TreeNode<T>>? Max(TreeNode<T>? node)
|
||||
{///Returns a Stack with the value on top being the maximum of the subtree
|
||||
if(node == default)
|
||||
return default;
|
||||
|
@ -142,20 +142,6 @@ namespace C_.Datastructures.LinkedList
|
||||
return node;
|
||||
}
|
||||
|
||||
//private static LinkedListNode<T>? Traverse(LinkedListNode<T> start){
|
||||
// //Start at given point in list
|
||||
// LinkedListNode<T>? node = start;
|
||||
// if (node != null)
|
||||
// {
|
||||
// //Continue to end of list
|
||||
// while (node!.Next != default)
|
||||
// {
|
||||
// node = (LinkedListNode<T>)node.Next;
|
||||
// }
|
||||
// }
|
||||
// return node;
|
||||
//}
|
||||
|
||||
private LinkedListNode<T>? Traverse(int i)
|
||||
{
|
||||
//Start at given point in list
|
||||
|
Loading…
Reference in New Issue
Block a user