func hash(key int) int { u64 := uint64(key) u64 ^= 0x_43ec_4853_c7e7_fa78 u64 *= 0x_c4ce_b9fe_1a85_ec53 return int(u64) } type node struct { lt *node gt *node key int } func rmroot(at **node) { var ( root = *at lt = root.lt gt = root.gt ) for { switch { case lt == nil: *at = lt return case gt == nil: *at = gt return case hash(lt.key) < hash(gt.key): *at = lt at = <.gt lt = lt.gt default: *at = gt at = >.lt gt = gt.lt } } }
To receive a hint, submit unfixed code.