Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions root-to-leaf_path(binary_tree).cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Question 6:

(BINARYTREE): Given a binary tree, print out all its root to leaf paths.
(BINARYTREE): Given a binary tree, print out all its root to leaf paths.

*/
#include<iostream>
Expand Down Expand Up @@ -51,7 +51,7 @@ void all_paths(struct node *root,queue<int> q,queue<int> q_temp)
else
{
/* if the node has both the left and right node then the root is pushed into the queue and
then the function is recalled with the subnodes as the root nodes */
then the function is recalled with the subnodes as the root nodes */
if(root->left!=NULL&&root->right!=NULL)
{
q.push(root->data);
Expand Down Expand Up @@ -94,7 +94,7 @@ struct node* newnode(int data)

int main()
/*
objective: to print out all its root to leaf paths of given binary tree
objective: to print out all its root to leaf paths of given binary tree
input parameters: none
output value: none
approach: a recursive function is called
Expand Down