Updated Inorder Traversal
This commit is contained in:
parent
a03771cce5
commit
5360fdd47b
@ -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;
|
||||
|
||||
Inorder(list, node!);
|
||||
LinkedList<T> list = LinkedList<T>.Create();
|
||||
|
||||
Inorder(list, Root!);
|
||||
return list;
|
||||
}
|
||||
private void Inorder(LinkedList<T> list, TreeNode<T> node)
|
||||
|
Loading…
Reference in New Issue
Block a user