Skip to main content
Contents Index
Search Book
close
Search Results:
No results.
Dark Mode Prev Up Next Scratch ActiveCode Profile
title here
\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 6.13 Search Tree Operations
Before we look at the implementation, let’s review the interface provided by the map ADT. You will notice that this interface is very similar to the Java HashMap class.
Map() creates a new empty map.
put(key, val) adds a new key–value pair to the map. If the key is already in the map, it replaces the old value with the new value.
get(key) takes a key and returns the matching value stored in the map or
null otherwise.
remove(key) deletes the key–value pair from the map. It returns the value associated with the removed key, or null if the key is not in the map.
size() returns the number of key–value pairs stored in the map.
containsKey(key) return
true if the key is in the map,
false otherwise.
You have attempted
of
activities on this page.