Updated Inorder Traversal
This commit is contained in:
parent
a03771cce5
commit
5360fdd47b
@ -116,17 +116,14 @@ namespace C_.Datastructures.BinaryTree
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedList<T>? Inorder(TreeNode<T>? node)
|
public LinkedList<T>? Inorder()
|
||||||
{
|
{//
|
||||||
LinkedList<T> list = LinkedList<T>.Create();
|
|
||||||
|
|
||||||
if (Count == 0)
|
if (Count == 0)
|
||||||
return default;
|
return default;
|
||||||
|
|
||||||
if (node == null)
|
|
||||||
node = Root;
|
|
||||||
|
|
||||||
Inorder(list, node!);
|
LinkedList<T> list = LinkedList<T>.Create();
|
||||||
|
|
||||||
|
Inorder(list, Root!);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
private void Inorder(LinkedList<T> list, TreeNode<T> node)
|
private void Inorder(LinkedList<T> list, TreeNode<T> node)
|
||||||
|
Loading…
Reference in New Issue
Block a user