Lect3-New- - Data Structures ADT List 1 ADT List Elements...

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

View Full Document Right Arrow Icon
1 Data Structures ADT List
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 ADT List Elements Structure Operations Domain Specification Representation Implementation User of an ADT must only know this Implementer must know all these.
Background image of page 2
3 ADT List: Specification Elements: The elements are of type <Type>. The elements are placed in nodes for linked list implementation. public class Node<T> extends Object { public T data; public Node<T> next; public Node () { data = null; next = null; } public Node (T val) { data = val; next = null; } }
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 ADT List: Specification Structure: the elements are linearly arranged, the first element is called head , there is a element called current , and there is a last element. Domain: the number of elements in the list is bounded therefore the domain is finite. Type name of elements in the domain: List
Background image of page 4
5 ADT List: Specification Operations: We assume all operations operate on a list L. 1. Method FindFirst ( ) requires: list L is not empty. input: none results: first element set as the current element. output: none. 1. Method FindNext ( ) requires : list L is not empty. Cur is not last. input : none results : element following the current element is made the current element. output : none. 1. Method Retrieve (Type e) requires : list L is not empty. input : none results : current element is copied into e. output : element e.
Background image of page 5

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

View Full DocumentRight Arrow Icon
ADT List: Specification Operations : 1. Method Update (Type e). requires : list L is not empty. input : e. results : the element e is copied into the current node. output : none. 5. Method Insert (Type e). requires : list L is not full. input : e. results : a new node containing element e is created and inserted after the current element in the list. The new element e is made the current element. If the list is empty e is also made the head element. output
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/18/2010 for the course COMPUTER S CSC212 taught by Professor Shah during the Winter '09 term at King Saud University.

Page1 / 30

Lect3-New- - Data Structures ADT List 1 ADT List Elements...

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

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