Skip to content

Instantly share code, notes, and snippets.

@themoah
Created January 28, 2017 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themoah/856959c8c49efbbc8f0a908c13097203 to your computer and use it in GitHub Desktop.
Save themoah/856959c8c49efbbc8f0a908c13097203 to your computer and use it in GitHub Desktop.
// pre-order sorting
Visit(Node current) {
if (current == null){
return;
}
Process(current.value);
Visit(current.Left);
Visit(current.Right);
}
// in-order sorting
Visit(Node current){
if (current == null) {
return;
}
Visit(current.Left);
Process(current.value);
Visit(current.Right);
}
// post order sorting
Visit(Node current){
if (current == null) {
return;
}
Visit(current.Left);
Visit(current.Right);
Process(current.value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment