Map Hash Tables and Dictionaries_Part_1

Map Hash Tables and Dictionaries_Part_1 - Maps Hash Tables...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Last Updated: 06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 1 - Maps, Hash Tables and Dictionaries Chapter 9
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Last Updated: 06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 2 - Maps A map models a searchable collection of key-value entries The main operations of a map are for searching, inserting, and deleting items Multiple entries with the same key are not allowed Applications: address book student-record database
Background image of page 2
Last Updated: 06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 3 - The Map ADT Map ADT methods: get (k): if the map M has an entry with key k, return its associated value; else, return null put (k, v): insert entry (k, v) into the map M; if key k is not already in M, then return null; else, return old value associated with k remove (k): if the map M has an entry with key k, remove it from M and return its associated value; else, return null size (), isEmpty () keys (): return an iterator of the keys in M values (): return an iterator of the values in M
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/14/2012 for the course CSE 2011Z taught by Professor Elder during the Fall '11 term at York University.

Page1 / 5

Map Hash Tables and Dictionaries_Part_1 - Maps Hash Tables...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online