promypro's blog

By promypro, 4 years ago, In English

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?

  • Vote: I like it
  • -21
  • Vote: I do not like it

| Write comment?
»
4 years ago, hide # |
 
Vote: I like it +23 Vote: I do not like it

You can do it in O(1)