Difference between revisions of "Chained Dictionary Assignment"

From CSE425S Wiki
Jump to navigation Jump to search
Line 19: Line 19:
  
 
[[File:Hash table 5 0 1 1 1 1 1 LL.svg]]
 
[[File:Hash table 5 0 1 1 1 1 1 LL.svg]]
 +
 +
[http://sml-family.org/Basis/array.html SML Array Structure]
  
 
  <nowiki>signature HASHED_DICTIONARY = sig include DICTIONARY
 
  <nowiki>signature HASHED_DICTIONARY = sig include DICTIONARY

Revision as of 15:50, 25 June 2019

signature DICTIONARY = sig
    type (''k,'v) dictionary
    val get : ((''k,'v) dictionary *''k) -> 'v option
    val put : ((''k,'v) dictionary *''k *'v) -> 'v option
    val remove : ((''k,'v) dictionary *''k) -> 'v option
    val entries : (''k,'v) dictionary -> (''k*'v) list
    val keys : (''k,'v) dictionary -> ''k list
    val values : (''k,'v) dictionary -> 'v list
end

SingleList Implementation

signature SINGLE_LIST_DICTIONARY = sig include DICTIONARY
    val create_simple : unit -> (''k,'v) dictionary
end

Hashtable Implementation

Hash table

Hash table 5 0 1 1 1 1 1 LL.svg

SML Array Structure

signature HASHED_DICTIONARY = sig include DICTIONARY
    type ''k hash_function = ''k -> int
    val create_hashed : (int * ''k hash_function) -> (''k,'v) dictionary
end