Are some data structures more suitable for functional programming than others?

后端 未结 9 845
灰色年华
灰色年华 2021-01-31 19:23

In Real World Haskell, there is a section titled \"Life without arrays or hash tables\" where the authors suggest that list and trees are preferred in functional programming, w

9条回答
  •  野性不改
    2021-01-31 19:51

    Chris Okasaki's thesis, Purely Functional Data Structures, is available for free online. It covers many different strategies for immutable persistent data representation.

    As far as really needing a hash table, consider that an O(lg n) lookup is only twenty times as slow as an O(1) lookup when you are searching a million elements.

提交回复
热议问题