assignment7_082267

# assignment7_082267 - then you switch the two nodes and...

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

Assignment 7 Question 11.13a. Describe how to support these operations in constant amortized time per operation. Question 11.13b. Describe how to support these operations in worst-case time per operation. Supporting these operations in either constant amortized or worst-case time operations will share the following steps: 1- Select any vertex as a starting point and construct the tour. 2- Apply tour extension. 3- Deletion insertion rule. 4- Apply the improvement step. 5- After passing all the vertices has not produced any improvement in the tour STOP, otherwise go to step 4. Push(x) and inject(x) are virtually identical in this operation with the exception of the side of the deque they effect. To push(x) or inject(x) an item onto the deque , you compare its value to its parent node; if its value is less than its parent node,

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: then you switch the two nodes and continue the process. Otherwise the condition is met that the node is less than its parent node, and so you can stop the process. Similarly, pop(x) and eject(x) are also virtually identical with respect to the side of the deque they effect. To pop() or eject() an item from the deque you compare its value with its two children. If the node is less than both of its children, it remains in place; otherwise, if it is greater than one or both of its children, then you switch it with the child of lowest value, thereby ensuring that of the three nodes being compared, the new parent node is lowest. For constant amortized time, apply this construct using the fibonacci heap data structure and for constant worst case time, apply this construct using splay trees....
View Full Document

## This note was uploaded on 01/19/2011 for the course BA 250 taught by Professor None during the Spring '10 term at Grantham.

### Page1 / 2

assignment7_082267 - then you switch the two nodes and...

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

View Full Document
Ask a homework question - tutors are online