Updated Inorder Traversal

This commit is contained in:
Luke Else 2022-04-19 21:09:33 +01:00
parent a03771cce5
commit 5360fdd47b

View File

@ -116,17 +116,14 @@ namespace C_.Datastructures.BinaryTree
return true;
}
public LinkedList<T>? Inorder(TreeNode<T>? node)
{
LinkedList<T> list = LinkedList<T>.Create();
public LinkedList<T>? Inorder()
{//
if (Count == 0)
return default;
if (node == null)
node = Root;
LinkedList<T> list = LinkedList<T>.Create();
Inorder(list, node!);
Inorder(list, Root!);
return list;
}
private void Inorder(LinkedList<T> list, TreeNode<T> node)