This preview shows page 1. Sign up to view the full content.
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
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.
- Fall '08
- Data Structures