Difference between revisions of "FP Laboratory 11"

From Marek Běhálek Wiki
Jump to navigation Jump to search
Line 5: Line 5:
 
* Create a function that counts the values stored in the leaves.
 
* Create a function that counts the values stored in the leaves.
 
* Create a function that extracts all values from the leaves into na list.
 
* Create a function that extracts all values from the leaves into na list.
* One possibility how to represent a tree in a textual form is <code>a(b(d,e),c(,f(g,)))</code>. Create functions that are able to read and store a tree in such a notation.
+
* One possibility how to represent a tree in a textual form is <code>a(b(d,e),c(e,f(g,h)))</code>. Create functions that are able to read and store a tree in such a notation.

Revision as of 13:55, 2 December 2019

Binary Trees

  • Create a data type that defines binary tree where values are stored in leaves and also in branches.
  • Prepare an example of a binary tree.
  • Create a function that counts the values stored in the leaves.
  • Create a function that extracts all values from the leaves into na list.
  • One possibility how to represent a tree in a textual form is a(b(d,e),c(e,f(g,h))). Create functions that are able to read and store a tree in such a notation.