Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

99 Elm Problems/Problem 60

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

60.a) Construct a height-­balanced binary trees with a given number of nodes. Consider a height­-balanced binary tree of height H. What is the maximum number of nodes it can contain? Clearly, MaxN = 2**H ­ 1. However, what is the minimum number MinN? This question is more difficult. 60.b) Find the minimum number of nodes in a height-­balanced binary tree of height H. 60.c) Find the maximum height H a height­-balanced binary tree with N nodes can have. Find out how many height-­balanced trees exist for N = 15. # # # THIS IS A STUB # # # Example in Elm: import Html exposing (text) import List f : Int -> Int -- your implementation goes here main = text (toString (f 0)) Result: 4 Solutions