lec07 - 07 Implementations of the List ADT Properties of...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 07 Implementations of the List ADT Properties of array and linked implementations Separate and inner node classes Singly and doubly linked lists CSE 12 Fundamental Data Structures: The Array and Linked Structures Introduction Any interface specification can be correctly implemented in many ways However, different correct implementations may have different performance characteristics It is important to know these characteristics, as they affect the performance of the resulting software Collection ADT's An ADT specifies a range of values that instances of the type can have, and operations on those values A collection ADT can use various data structures to implement its values The data structure a collection ADT uses internally is sometimes called its backing store For the List ADT, the backing store is typically chosen to be either an array, or a linked list Array Characteristics An array is a homogeneous data structure: all elements are of the same type The elements of an array are in adjacent memory locations Because each cell has the same size, and the cells are adjacent in memory, it is possible to quickly calculate the address of any array cell, given the address of the first cell so accessing any array cell is constant time: just one multiplication, one addition, and one memory access an array is a random (direct) access structure Linked Structure Characteristics Nodes in a linked structure are allocated and deallocated dynamically, as needed The nodes of a linked structure are created at different times, and are probably not adjacent in memory Even if the address of the first node in a linked structure is known, it is impossible to calculate the address of any other node; instead each node stores the address of the next node in the structure so a node access requires visiting all previous nodes in the structure in sequence a linked structure is a sequential access structure 05-6/45 Array Versus Linked Structures 05-7/45 Array Operations and Time Costs Searching O( n ) if array is unsorted, O(log n ) if sorted Resizing have to make a new array that is smaller or...
View Full Document

Page1 / 27

lec07 - 07 Implementations of the List ADT Properties of...

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

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