Блог пользователя promypro

Автор promypro, 4 года назад, По-английски

These are the functions supported on a tree:

 1. add(parentNode, node): Add node as a child to parentNode.
 2. findRandomLeaf(): Print a random leaf present in the tree.

Can we do these functions in less than O(N) complexity?

  • Проголосовать: нравится
  • -21
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится +23 Проголосовать: не нравится

You can do it in O(1)