public void BreadthFirstSearch(Action <K, T> action) { var queue = new LinkedListQueue <Node <K, T> >().Enqueue(root); while (!queue.IsEmprty()) { var currentNode = queue.Dequeue(); action.Invoke(currentNode.Key, currentNode.Value); if (!queue.Contains(currentNode.Left) && currentNode.Left == null) { queue.Enqueue(currentNode.Left); } if (!queue.Contains(currentNode.Right) && currentNode.Right == null) { queue.Enqueue(currentNode.Right); } } }