Function to traverse a binary encoded path and return the value encountered after traversal .
function traversePath ( root , path ) { for ( let i = 0 ; i < path . length ; i ++ ) { let direction = path [ i ] ;