by archgoon · 10y ago · 0 comments
a b c d e f g h i j
How many ways can you do that with a binary operation? i.e. how many ways can you completely parenthesise that expression. e.g. ((a (((b (c d)) e) ((f g) h)) i) j)
I haven't worked it out exactly, but I think it's about a trillion.On the other hand, suppose your binary operation is associative. How many different ways are there now? Effectively one.
That's a huge reduction in complexity. The notion of associativity is extremely useful in developing composable programs.
Anyway, 4862 times is still a substantial complexity reduction.
Thanks for the correction.