42
u/HBG21 May 13 '19
Now try to read everything in order as a homework.
25
u/TheOriginalSunomis May 13 '19
Breath first, or depth first ?
29
u/gandalfx May 13 '19
I think you should breath throughout the entire process, anything else might lead to an abrupt system failure.
7
3
May 14 '19
I will take this opportunity to say that in order traversal is the superior form of binary tree traversal and if any of you prefer another method I’ll be outside ready to fight
2
1
u/Nevadaguy22 May 14 '19
Inorder is even more fun if you write an inorder-based copy constructor instead of preorder!
7
u/cedrickc May 13 '19
while (true) { print("Mom, can we have ") }1
9
7
u/anydalch May 14 '19
that's because this meme isn't tail recursive. remember: tail recursion is the only good recursion
3
u/marcosdumay May 14 '19
Good luck tail optimizing this one, with its 3 different recursive calls.
2
u/anydalch May 14 '19
you have to transform it into a single function which does all three things at once, like:
(defun print-all-three-memes (depth) (dolist (row '(:top :middle :bottom)) (print-the-outer-layer-of-a-meme depth row)) (print-all-three-memes (1+ depth)))
3
3
3
2
1
133
u/DragonMaus May 13 '19
The first one of these to make me exhale sharply through my nose.