Sync
@mkhalilov maybe we can merge this now. It's not intergated to the main file, but I added the files and a test case. Only linear implemented here. I'm a bit confused with the tree algorithm, so I'd say I spend few hours to read more and read some code to understand how it works, and then I start implementing.
I'd like to merge this to minimize the changes because in the weekend I plan to add more (and at the end it'd be difficult to PR all changes)