Skip to content

Instantly share code, notes, and snippets.

@JuanSeBestia
Created March 25, 2021 17:44
Show Gist options
  • Save JuanSeBestia/896c64ee9f82224f075debc0247a2e30 to your computer and use it in GitHub Desktop.
Save JuanSeBestia/896c64ee9f82224f075debc0247a2e30 to your computer and use it in GitHub Desktop.
Structures.js
class Hoja {
constructor(left = null, right = null, root = null) {
this.left = left;
this.right = right;
this.root = root;
}
}
var root = new Hoja();
root.left = new Hoja(null, null, root);
root.right = new Hoja(new Hoja(null, null, root), new Hoja(null, null, root));
var current = root;
while(current.left || current.root){
console.log(current)
if(current.root){
current = current.root
}else{
current = current.left
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment