Dictionaries

Dictionaries - 4/1/2003 8:39 AM Dictionaries 1 Dictionaries...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4/1/2003 8:39 AM Dictionaries 1 Dictionaries 6 9 2 4 1 8 < > = 4/1/2003 8:39 AM Dictionaries 2 Outline and Reading Dictionary ADT (8.1.1) Log file (8.1.1) Binary search (8.3.3) Lookup table (8.3.2) Binary search tree (9.1) Search (9.1.1) Insertion and deletion (9.1.2) Performance (9.1.4) 4/1/2003 8:39 AM Dictionaries 3 Dictionary ADT The dictionary ADT models a searchable collection of key- element items The main operations of a dictionary are searching, inserting, and deleting items Multiple items with the same key are allowed Applications: address book credit card authorization mapping host names (e.g., cs16.net) to internet addresses (e.g., 128.148.34.101) Dictionary ADT methods: find (k): if the dictionary has an item with key k, returns the position of this item, else, returns a null position. insertItem (k, o): inserts item (k, o) into the dictionary removeElement (k): removes the item with key k from the dictionary. If no such element exists, an error occurs. size (), isEmpty () keys (), Elements () 4/1/2003 8:39 AM Dictionaries 4 Log File A log file is a dictionary implemented by means of an unsorted sequence We store the items of the dictionary in a sequence (based on a doubly-linked lists or a circular array), in arbitrary order Performance:...
View Full Document

Page1 / 2

Dictionaries - 4/1/2003 8:39 AM Dictionaries 1 Dictionaries...

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

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