icon
Published on

Lockable Tree - Google Interview Question

Authors

Content

Lockable Tree - Google Interview Question

https://quanticdev.com/algorithms/trees/lockable-tree/

  • https://quanticdev.com/algorithms/trees/lockable-tree/
  • Lockable Tree - Google Interview Question
  • Lockable tree is a great programming interview question asked by Google, and it is a very well thought out one. A lockable tree is a tree with nodes that can be locked if none of its ancestors and descendants is locked. In the question, we are asked to implement locking/unlocking operations that should run in O(h) time where h is the height of the tree. Lock/unlock methods do not need to be thread-safe.