notes104

# notes104 - CS 251 Data Structures Instructor Gustavo...

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

CS 251 Data Structures Instructor : Gustavo Rodriguez-Rivera Computer Science, Purdue University Lecture notes (01-28-02 to 02-01-02) Topics: Ranked Sequences (cont.) Trees - Traversals - Euler Tour Traversal Priority Queues Ranked Sequences (cont.): When ranked sequences are implemented with double linked lists, we may also have operations such as. .. insertAfterNode (DLNode node, Object obj); insertBeforeNode (DLNode node, Object obj); remove (DLNode removeNode); All of above functions take O(1) time (constant time). These operation are not available when ranked sequences are implemented with arrays. The closest we can get. .. insertAtRank (int rank, Object obj); removeAtRank (int rank, Object obj); They take O(n) time. The sequences that provide insertAfterNode(. ..), insertBeforeNode(. ..), and remove(. ..) are called "Positional Ranked Sequences". For these kind of sequences a node is called a "position". So the functions for Positional Ranked Sequences are. .. insertAfterPosition (Position pos, Object obj); insertBeforePosition (Position pos, Object obj); remove (Position removePos); The interface of a "Position" object could be. .. interface Position{ Position getNext(); void setNext (Position pos); Position getPrevious(); void setPrevious (Position pos);

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

View Full Document
void setElement (Object obj); } Back to Top TREES Topics: - Definitions - Traversal - Euler Tour Traversal - Vector based representation A tree represents a hierarchy. A file System.
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.

### Page1 / 10

notes104 - CS 251 Data Structures Instructor Gustavo...

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

View Full Document
Ask a homework question - tutors are online