breadth-first traversal this kind of traversal starts from the root of tree and visits the node from one level of the tree to the otherthe node at level is node we visit this node by printing out its value nextwe move to level and visit the nodes on that levelwhich are nodes and on the last levellevel we visit nodes and the complete output of such traversal is and this mode of traversal is made possible by using queue data structure starting with the root nodewe push it into queue the node at the front of the queue is accessed (dequeuedand either printed and stored for later use the left node is added to the queue followed by the right node since the queue is not emptywe repeat the process dry run of the algorithm will enqueue the root node dequeueand accessor visit the node nodes and are enqueued as they are the left and right nodes respectively node is dequeued in order to be visited its left and right nodes and are enqueued at this pointthe node at the front of the queue is we dequeue and visit node after which we enqueue its left and right nodes so the process continues until the queue is empty the algorithm is as followsfrom collections import deque class treedef breadth_first_traversal(self)list_of_nodes [traversal_queue deque([self root_node]