News for hackers. Stuff that matters.
Re:Bootstrapping My Side Project to $6k/Month by tomp on Thursday November 16, 2017 @11:34AM (#15714008)
Haha, I've been a programmer for most of my life and I don't know what "inverting" a binary tree even means!
Re:Bootstrapping My Side Project to $6k/Month by guessmyname on Thursday November 16, 2017 @11:44AM (#15714109)

            2                             2        
           / \                           / \       
          /   \                         /   \      
         /     \                       /     \     
        1       3                     3       1    
       / \     / \                   / \     / \   
      0   7   9   1    reverse >>>  1   9   7   0  
     /   / \     / \               / \     / \   \ 
    2   1   0   8   8             8   8   0   1   2
           /                               \       
          7                                 7
Re:Bootstrapping My Side Project to $6k/Month by tomp on Thursday November 16, 2017 @05:52PM (#15717443)
Ah, I would personally call that "flipping", I kind-of imagined that "inverting" would mean maybe taking a node and putting in the root of the tree or something similar...
Re:Bootstrapping My Side Project to $6k/Month by mullen on Thursday November 16, 2017 @12:23PM (#15714522)
Why would you want to reverse/inverse a binary tree?
Re:Bootstrapping My Side Project to $6k/Month by sushid on Thursday November 16, 2017 @02:43PM (#15715855)
It's an easy way to check if you can think recursively/are familiar with a btree.
Re:Bootstrapping My Side Project to $6k/Month by hinkley on Thursday November 16, 2017 @12:00PM (#15714271)
That’s reversing a binary tree.
Re:Bootstrapping My Side Project to $6k/Month by guessmyname on Thursday November 16, 2017 @12:13PM (#15714417)
Re:Bootstrapping My Side Project to $6k/Month by hinkley on Thursday November 16, 2017 @05:14PM (#15717172)

    This problem was inspired by this original tweet by Max Howell
There are many definitions of invert. This is relying on one definition that is jargon, and not widely agreed upon jargon at that.

For a two or more dimensional “object”. Invert means to reorient the top and the bottom, while reverse swaps the left and the right.

The two only might mean the same thing with one dimensional data structures. For instance inverting a line of text might (ambiguously) mean reversing it. Or drawing it upside down. Or upside down and backward. But at least you would expect a clarification.

Re:Bootstrapping My Side Project to $6k/Month by nathan_f77 on Thursday November 16, 2017 @12:42PM (#15714688)
That was fun, thanks! I remember reading that tweet a while ago, and "inverting a binary tree" sounded very complicated, but it's really just one line of code.
Re:Bootstrapping My Side Project to $6k/Month by nnd on Thursday November 16, 2017 @04:24PM (#15716764)
I'd be very careful now, you might not be a REAL programmer.