{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lab_005 - 15-121 Fall 2009 Homework Assignment 6 Amortized...

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

View Full Document Right Arrow Icon
15-121 Fall 2009 Homework Assignment 6 Amortized Array-Based Dictionary Overview: One of the most important structures in computer science are the dictionary data structures that support fast insert and lookup operations. Dozens of different data structures have been proposed for implementing dictionaries including hash tables, skip lists, search trees and others. In this lab assignment you will implement a dictionary based on linked lists and sorted arrays. This structure combines a fast lookup on sorted arrays with ease of linked list-insertion. Note that a sorted array is good for lookups (think of a binary search) but bad for inserts. A linked list is good for inserts but bad for lookups (they can take linear time). The idea of this data structure is as follows. We will have a linked list of arrays, where array k has size 2 k , and each array is in sorted order. However, there will be no relationship between the items in different arrays. The issue of which arrays to be used is based on the binary representation of the number of items we are storing. For example, if we have 11 items to store, then the arrays of sizes 1, 2, and 8 will be used, since 11 = 1 + 2 + 8, and our dictionary might look like this: This data structure has interesting amortized and average-case performance, hence the name "Amortized Array-Based Dictionary" (AAD).
Background image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}