More exciting (if ML is your thing) news:
when I reinstituted the call for mem x,
let rec mem x = function
Leaf -> false
| Node (_, y, left, right) ->
x = y || (x < y && mem x left) || (x > y && mem x right)
;;
emptied the tree, re-loaded the 5,000 or so of 10,000 unsorted numbers I
got this:
# mem 7178 s;;
- : bool = true
# mem 285 s;;
- : bool = true
# mem 6009 s;;
- : bool = true
# mem 6008 s;;
- : bool = false
6008 is in the chopped out section of the original 10,000. OCaml reads this
list of int's in the blink of an eye; the entire list!
Jonathan Engwall
On Tue, May 4, 2021 at 12:53 PM Jonathan Engwall <
[email protected]> wrote:
> Hello Beowulf,
> After this brief OCaml video https://youtu.be/a3kVJKt9mq4 I created a
> larger data set one with 5,000 of 10,000 numbers sequenced randomly. It
> illuminates the workings of RED BLACK binary tree.
>
> Simply copy&paste (ctrl k ctrl v) the large set to the command line. OCaml
> immediately builds several BLACK root nodes searching for a "balance point."
> I give a link to the RED BLACK implementation and larger data set. My
> source receives credit as well.
>
> Earlier experience with simple routines like fibonacci have me worried
> that OCaml is slow, RED BLACK's all short branches look quite fast.
>
> Jonathan Engwall
>
_______________________________________________
Beowulf mailing list, [email protected] sponsored by Penguin Computing
To change your subscription (digest mode or unsubscribe) visit
https://beowulf.org/cgi-bin/mailman/listinfo/beowulf