Skip to content

Instantly share code, notes, and snippets.

@xnorcode
Created October 7, 2018 22:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Depth-First Search Pre-Order traversal
...
// DSF pre-order print of all values in BST
static void printPreOrder(Node current){
// print current node data
System.out.println(current.data);
// print left child
if(current.left != null) printInOrder(current.left);
// print right child
if(current.right != null) printInOrder(current.right);
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment