Lecture 15 Section 6.1 Mon, Feb 26, 2007

Slides:



Advertisements
Similar presentations
C++ Classes & Data Abstraction
Advertisements

What is a Queue? n Logical (or ADT) level: A queue is an ordered group of homogeneous items (elements), in which new elements are added at one end (the.
1 A full binary tree A full binary tree is a binary tree in which all the leaves are on the same level and every non leaf node has two children. SHAPE.
Lecture 3 Feb 4 summary of last week’s topics and review questions (handout) Today’s goals: Chapter 1 overview (sections 1.4 to 1.6) c++ classes constructors,
The Template Class Chain Chain Linear list. Each element is stored in a node. Nodes are linked together using pointers.
COMP 171 Data Structures and Algorithms Tutorial 1 Template and STL.
Chapter 3 Data Abstraction: The Walls. © 2005 Pearson Addison-Wesley. All rights reserved3-2 Abstract Data Types Typical operations on data –Add data.
1 C++ Plus Data Structures Nell Dale Queues ADTs Stack and Queue Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus Modified.
Stacks  Standard operations: IsEmpty … return true iff stack is empty Top … return top element of stack Push … add an element to the top of the stack.
Dynamic Objects II. COMP104 Lecture 31 / Slide 2 A Simple Dynamic List  An integer list: IntArray * Features n Can be passed by value & reference n Can.
Chapter 4 Linked Lists. © 2005 Pearson Addison-Wesley. All rights reserved4-2 Preliminaries Options for implementing an ADT List –Array has a fixed size.
Linear Lists – Linked List Representation CSE, POSTECH.
1 Chapter 3 Lists, Stacks, and Queues Abstract Data Types, Vectors Sections 3.1, 3.2, 3.3, 3.4 Abstract Data Types (ADT) Iterators Implementation of Vector.
Lists Lecture 16 Fri, Mar 3, Topics Lists List ADT Attributes Constructors Destructor Inspectors Mutators Facilitators Operators Other List Functions.
1 Joe Meehean.  Conceptual Picture N items chained together using pointers pointed to by head variable  Advantage allows list to grow indefinitely without.
Generic Positional Containers and Double-Ended Queues.
DATA STRUCTURES AND ALGORITHMS Lecture Notes 4 Prepared by İnanç TAHRALI.
1 Chapter 7 Stacks and Queues. 2 Stack ADT Recall that ADT is abstract data type, a set of data and a set of operations that act upon the data. In a stack,
J. P. Cohoon and J. W. Davidson © 1997 McGraw-Hill, Inc. Templates Generic functions and classes.
A Generic List Class and Linked Lists Andy Wang Data Structures, Algorithms, and Generic Programming.
1 Data Structures CSCI 132, Spring 2014 Lecture 20 Linked Lists.
Lab05. // // // Laboratory 5 ListLinked.h // // Class declaration for the linked implementation.
The List ADT Reading: Sections 3.2, 3.3, 3.5.
1 Chapter 3 Lists, Stacks, and Queues Reading: Sections 3.1, 3.2, 3.3, 3.4 Abstract Data Types (ADT) Iterators Implementation of Vector.
114 3/30/98 CSE 143 Collection ADTs [Chapter 4] /30/98 Collection ADTs  Many standard ADTs are for collections  Data structures that manage groups.
1 Generic Positional Containers and Double-Ended Queues.
The Class arrayList General purpose implementation of linear lists. Unknown number of lists.
Cpt S 122 – Data Structures Abstract Data Types
The List ADT Sections 3.2, 3.3, 3.5 Introduction
Data Abstraction: The Walls
Lists The List ADT.
Chapter 4 Linked Lists
Binary Trees Lecture 36 Wed, Apr 21, /21/2018 Binary Trees.
Linked List Yumei Huo Department of Computer Science
Chapter 16-2 Linked Structures
Abstract Data Types Iterators Vector ADT Sections 3.1, 3.2, 3.3, 3.4
Linked Lists.
Object Oriented Programming COP3330 / CGS5409
Chapter 4 Linked Lists.
The Class arrayList General purpose implementation of linear lists.
Generic Positional Containers and Double-Ended Queues
Chapter 18: Linked Lists.
CS 302 Data Structures Linked Lists.
Lists List: finite sequence of data elements
Chapter 3 Lists, Stacks, and Queues Abstract Data Types, Vectors
EE 422C Sets.
CSCI 3333 Data Structures Linked Lists
Introduction to Programming
Doubly Linked List Implementation
Chapter 4 Linked Lists.
Data Abstraction: The Walls
Inheritance: The Fundamental Functions
Lists - I The List ADT.
Lists - I The List ADT.
Lecture 16 Section 6.2 Thu, Mar 1, 2007
Queues Lecture 30 Fri, Apr 2, /3/2019 Queues.
Lists - I The List ADT.
Recursive Linked Lists
Recursive Linked Lists
Lists - I The List ADT.
Lists CMSC 202, Version 4/02.
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Data Abstraction: The Walls
Lists CMSC 202, Version 4/02.
Doubly Linked List Implementation
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Abstract Data Types ADT: A set of objects and a set of operations on those objects. examples: integers: +, - , *, … Collection, insert, remove, … set:
Chapter 3 Lists, Stacks, and Queues
The List Container and Iterators
Presentation transcript:

Lecture 15 Section 6.1 Mon, Feb 26, 2007 Lists Lecture 15 Section 6.1 Mon, Feb 26, 2007

Lists A list is an ordered set of elements {a1, …, an} The indexing begins at 1, not 0. a1 is at the head of the list. an is at the tail of the list. The elements ai may be of any type. But they must all be of the same type. The structure is homogeneous. A list is a generalization of an array.

List ADT: List Attributes A list has a size elements a1 through asize.

List ADT: Constructors List(int sz); List(int sz, const T& value); List(const List& lst);

List ADT: Destructor Destructor ~List();

List ADT: Inspectors Inspectors T getElement(int pos) const; int size() const; bool isEmpty() const;

List ADT: Mutators Mutators void setElement(int pos, const T& value); void insert(int pos, const T& value); void remove(int pos); void makeEmpty();

List ADT: Mutators Additional Mutators void pushFront(const T& value); void pushBack(const T& value); T popFront(); T popBack();

List ADT: Facilitators void input(istream& in); void output(ostream& out) const;

List ADT: Operators Operators List& operator=(const List& lst); T& operator[](int pos);

List ADT: Other Member Functions void swap(List& lst); int search(const T& value) const; void sort(); bool isValid() const;