This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DFS { | |
enum Method { | |
PreOrder, InOrder, PostOrder | |
} method; | |
enum Direction { | |
LeftToRight, RightToLeft | |
} direction; | |
template <typename TreeNode> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// suppose `brothers` has a user_id foreign key | |
class User extends Model | |
{ | |
public function brothers() { | |
return $this->hasMany('App\Brother'); | |
} | |
} | |
// bad way |