Difference between revisions of "FP Laboratory 11"

From Marek Běhálek Wiki
Jump to navigation Jump to search
(Created page with "== Binary Trees == * Create a data type that defines binary tree where values are stored in leaves. * Prepare an example of a binary tree. * Create a function that counts th...")
 
Line 1: Line 1:
 
== Binary Trees ==
 
== Binary Trees ==
  
* Create a data type that defines binary tree where values are stored in leaves.  
+
* 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.
 
* Prepare an example of a binary tree.
 
* 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.

Revision as of 12:31, 18 September 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(,f(g,))). Create functions that are able to read and store a tree in such a notation.