HN2
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
tom_
on Nov 24, 2022
|
parent
|
context
|
favorite
| on:
Inverting a binary tree using x64 assembly
"Flip" or "mirror" is probably a better term. It seems the goal is to swap left and right:
https://leetcode.com/problems/invert-binary-tree/
LanceH
on Nov 25, 2022
|
next
[–]
I don't get why this one is the meme. Just because it's recursion? Because it's (nearly) pointless? There are so many other algorithms I find more difficult/more tedious.
plasticchris
on Nov 25, 2022
|
parent
|
next
[–]
I think it’s a meme because the home brew author tweeted that he was rejected by Google for failing to invert a binary tree.
kristov
on Nov 24, 2022
|
prev
[–]
Is there a practical reason to do this in a real-world program?
saagarjha
on Nov 24, 2022
|
parent
[–]
Sure, it’s the binary tree equivalent of reversing an array.
Tainnor
on Nov 25, 2022
|
root
|
parent
[–]
For large enough trees it's probably more efficient to instead just switch from preorder to postorder traversal instead of changing the whole tree.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: