Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.60 KB | None | 0 0
  1. (*Basically a Tree has a boolean, and a list of (char, tree(childs)). Image for easier understanding http://i.imgur.com/rHKQDyl.png
  2.  
  3. The tree contains words. let's say we have 'h'(false)->'e'(false)->'l'(false)->'l'(true)->'o'(true)
  4. False means it's not a word, True means it's a word (in that example we have Hell and Hello).*)
  5.  
  6. type tree =  Node of bool ref  * (char * tree) list ref (* This cannot be changed *)
  7.  
  8. let empty () = Node(ref false,ref[])
  9.  
  10. (* Function make_branch: char list -> tree
  11.     Where the char list is a word
  12. *)
  13. let rec make_branch lc =
  14.    (*I must implement code here *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement