2 ms·
> but have yet to run into a time where I needed to understand or write a binary tree. I ran a UI team for 3 years, we built a UI framework, then the UI and ap
by com2kid 5y ago
> but have yet to run into a time where I needed to understand or write a binary tree.
I ran a UI team for 3 years, we built a UI framework, then the UI and apps on top of it.
We lived trees and tree traversals. Understanding trees was essential to everything we did.
Do I ask people to balance trees? No, but I do care if people can understand traversals, and also how to manipulate and design tree structures to solve business problems. Being able to design the right data structure to solve a problem is an important skill, and trees are one of our fields fundamental data structures.
- ChrisMarshallNY 5y agoNot surprised, but not everyone writes frameworks. I write end-user apps. There's a lot of us, out there. I have written quite a few frameworks, SDKs and APIs; both server-based and host-based, and never had to deal with this stuff. If I had, I would have done what I always do, when I get to that point: Learn what I need to learn. I have been learning new stuff, my entire career. I don't know how to do almost every project I take on. I even wrote about it, here: https://littlegreenviper.com/miscellany/thats-not-what-ships-are-built-for/ https://littlegreenviper.com/miscellany/thats-not-what-ships...
- com2kid 5y agoOne of my favorite questions to ask is how to find the first cousin of a node in a binary tree. A lot of people try to start at root, enumerate the level of nodes for the entire tree, and then return non-sibling nodes at the same level as the node we want to find the first cousin of. Which works, but it is O(n) and a lot of work. People who know about parent pointers in trees just walk up a couple levels and then down a couple of levels. I consider it a fair question because, it has no gotchas, it is just understanding how to efficiently walk around one of the most commonly encountered data structures. My other go to question is provided a library function that can schedule a callback to run anytime in the next 2147483ms, write a wrapper that can schedule a callback at any arbitrary time in the future. For advanced candidates I provide a library of date/time functions and they have to take in a date/time and using the provided limited functionality scheduling callback, call the passed in function at the proper date/time. This is a very simple problem, and one that I've encountered in real life[0]. It is a trivial, but again real life problem of building functionality on top of a limited platform API. I have seen this question trip up countless candidates, who try to seriously over model the solution. I have no idea why a class with 1 function and a couple int64 variables counting down time seems so hard! (Old school C programmers tend to get it right away) [0] Windows timer APIs like their 100 nanosecond parameters, though now days they all have modern 64 bit FILETIME variants that side step this entire issue.