Lists Lecture 16 Fri, Mar 3, 2006. Topics Lists List ADT Attributes Constructors Destructor Inspectors Mutators Facilitators Operators Other List Functions.

Slides:



Advertisements
Similar presentations
Chapter 18 Vectors and Arrays
Advertisements

Lists: An internal look
Alan YorinksLecture 7 1 • Tonight we will look at:: • List ADT • Unsorted List • Sequential Search • Selection Sort • Sorted List • Binary Search.
1 CSC241: Object Oriented Programming Lecture No 21.
Introduction to Programming Lecture 39. Copy Constructor.
C++ Classes & Data Abstraction
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.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 18: Stacks And Queues.
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.
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.
1 Standard Containers: Lists Gordon College Resource:
1 Chapter 6 Lists Plus. ADT Sorted List Operations Transformers n MakeEmpty n InsertItem n DeleteItem Observers n IsFull n LengthIs n RetrieveItem Iterators.
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.
1 Chapter 16-1 Linked Structures Dale/Weems. 2 Chapter 16 Topics l Meaning of a Linked List l Meaning of a Dynamic Linked List l Traversal, Insertion.
Generic Positional Containers and Double-Ended Queues.
DATA STRUCTURES AND ALGORITHMS Lecture Notes 4 Prepared by İnanç TAHRALI.
Copyright © 2012 Pearson Education, Inc. Chapter 18: Stacks And Queues.
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.
1 Inside the Vector Class: with additional needed methods CPS212CPS212 Gordon College.
1 Chapter 16 Linked Structures Dale/Weems/Headington.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
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.
Data Structures Using C++1 Chapter 3 Pointers Dr. Liu.
1 Chapter 13-1 Applied Arrays: Lists and Strings Dale/Weems.
ITERATORS. Iterator An iterator in C++ is a concept that refines the iterator design pattern into a specific set of behaviors that work well with the.
Binary Trees. A Binary tree is a tree in which every node has none, one, or at most, two children A Proper Binary Tree has two children or no children.
1 Chapter 13-2 Applied Arrays: Lists and Strings Dale/Weems.
The List ADT Reading: Sections 3.2, 3.3, 3.5.
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department.
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
Object Oriented Programming COP3330 / CGS5409
Chapter 4 Linked Lists.
Generic Positional Containers and Double-Ended Queues
CS 302 Data Structures Linked Lists.
Chapter 3 Lists, Stacks, and Queues Abstract Data Types, Vectors
Introduction to Programming
Doubly Linked List Implementation
Chapter 4 Linked Lists.
Lists - I The List ADT.
Lists - I The List ADT.
Lecture 15 Section 6.1 Mon, Feb 26, 2007
Queues Lecture 30 Fri, Apr 2, /3/2019 Queues.
Lists - I The List ADT.
Lists - I The List ADT.
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:
The List Container and Iterators
Presentation transcript:

Lists Lecture 16 Fri, Mar 3, 2006

Topics Lists List ADT Attributes Constructors Destructor Inspectors Mutators Facilitators Operators Other List Functions

Lists A list is an ordered set of elements {a 1, …, a n } The indexing begins at 1, not 0. The elements a i 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 a 1 through a size.

List ADT: Constructors Constructors List(); 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 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 Other Member Functions void swap(List& lst); int search(const T& value) const; void sort(); bool isValid() const;