MCPcopy Create free account
hub / github.com/geekcomputers/Python / get_level

Function get_level

binary_search_tree.py:322–334  ·  view source on GitHub ↗
(n, val)

Source from the content-addressed store, hash-verified

320
321
322def get_level(n, val):
323 c_level = 0
324
325 while n.info != val:
326 if val < n.info:
327 n = n.left
328 elif val > n.info:
329 n = n.right
330 c_level += 1
331 if n is None:
332 return -1
333
334 return c_level
335
336
337def depth(node):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected