TreeSensing: Linearly Compressing Sketches with Flexibility