notes105 - CS 251 Date: 01/28/02 02/01/02 Notes : Gustavo...

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

View Full Document Right Arrow Icon
CS 251 Date: 01/28/02 – 02/01/02 Notes : Gustavo Rodriguez-Rivera Creator: Dharmesh Shah When ranked sequences are implemented with double linked lists, we may also have operations such as: InsertAfterNode(DLNode,Object o); InsertBeforeNode(DLNode,Object o); Remove(DLNode removenode); All of them take O(1) These operations are not available when ranked sequences are implemented with arrays. The closest we can get are insertAtRank(int rank,Obj o) andremoveAtRank(int rank,Obj o), but they take O(n). Positional Ranked Sequences The sequences that provide the insertAfterNode, insertBeforeNode and remove are called “Positional Ranked Sequences”. For this kind of sequences a node is also called a “ position ”. So methods for positional ranked sequences are:- InsertAfterPosition(Position p, Object o) InsertBeforePosition(Position p, Object o) Remove(Position pos) Interface of a “position” object would be interface position { Position getNext(); void setNext(Position p); Position getPrevious(); void setPrevious(Position p); Object getElement(); void setElement( Object obj); }
Background image of page 1

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

View Full DocumentRight Arrow Icon
. Trees File System Arithmetic Operations (3+4) * 5
Background image of page 2
Definitions A – Root Node C – Sibling of B D, E, F, G, H – External or leaves
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
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-West Lafayette.

Page1 / 12

notes105 - CS 251 Date: 01/28/02 02/01/02 Notes : Gustavo...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online