Map Hash Tables and Dictionaries_Part_8

Map Hash Tables and Dictionaries_Part_8 - A List-Based...

Info iconThis preview shows pages 1–3. 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 - 36 - A List-Based Dictionary A log file or audit trail 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 list or array), in arbitrary order Performance: insert takes O (1) time since we can insert the new item at the beginning or at the end of the sequence find and remove take O ( n ) time since in the worst case (the item is not found) we traverse the entire sequence to look for an item with the given key The log file is effective only for dictionaries of small size or for dictionaries on which insertions are the most common operations, while searches and removals are rarely performed (e.g., historical record of logins to a workstation)
Background image of page 1

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

View Full DocumentRight Arrow Icon
06/02/12 10:23 PM CSE 2011 Prof. J. Elder - 37 - The findAll(k) Algorithm Algorithm findAll( k ): Input: A key k Output: An iterator of entries with key equal to k Create an initially-empty list
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

Map Hash Tables and Dictionaries_Part_8 - A List-Based...

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

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