Locators - Locators 4/1/2003 8:45 AM Outline and Reading 3a...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
4/1/2003 8:45 AM Locators 1 Locators 3 a 1 g 4 e 4/1/2003 8:45 AM Locators 2 Outline and Reading Locators (§7.4, §9.6) Locator-based methods (§7.4.1) Implementation Positions vs. Locators 4/1/2003 8:45 AM Locators 3 Locators A locators identifies and tracks a (key, element) item within a data structure A locator sticks with a specific item, even if that element changes its position in the data structure Intuitive notion: ± claim check ± reservation number Methods of the locator ADT: ± key (): returns the key of the item associated with the locator ± element (): returns the element of the item associated with the locator Application example: ± Orders to purchase and sell a given stock are stored in two priority queues (sell orders and buy orders) ² the key of an order is the price ² the element is the number of shares ± When an order is placed, a locator to it is returned ± Given a locator, an order can be canceled or modified 4/1/2003 8:45 AM Locators 4 Locator-based Methods
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/02/2012 for the course CS 251 taught by Professor Staff during the Fall '08 term at Purdue University.

Ask a homework question - tutors are online