CH 1-4 : INTRODUCTION ACKNOWLEDGEMENT: THE SLIDES ARE PREPARED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND.

Slides:



Advertisements
Similar presentations
Stacks.
Advertisements

© 2004 Goodrich, Tamassia Node-Lists1 6.2 Node Lists.
Stacks. 2 Outline and Reading The Stack ADT (§4.2.1) Applications of Stacks (§4.2.3) Array-based implementation (§4.2.2) Growable array-based stack.
1 Problem Solving Abstraction Oftentimes, different real-world problems can be modeled using the same underlying idea Examples: Runtime storage, Undo operation.
Stacks. 2 Outline and Reading The Stack ADT (§2.1.1) Array-based implementation (§2.1.1) Growable array-based stack (§1.5) Java.util.Stack class Java.util.Vector.
Part-B1 Stacks. Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An ADT specifies: Data stored Operations.
Stacks. 2 Outline and Reading The Stack ADT (§2.1.1) Applications of Stacks (§2.1.1) Array-based implementation (§2.1.1) Growable array-based stack (§1.5)
Doubly Linked Lists1 © 2014 Goodrich, Tamassia, Goldwasser Presentation for use with the textbook Data Structures and Algorithms in Java, 6 th edition,
© 2004 Goodrich, Tamassia Linked Lists1. © 2004 Goodrich, Tamassia Linked Lists2 Singly Linked List (§ 4.4.1) A singly linked list is a concrete data.
Chapter 3: Arrays, Linked Lists, and Recursion
CS212D : DATA STRUCTURES 1 Week 5-6 Linked List. Outline 2  Singly Linked Lists  Doubly Linked Lists  Recursions.
Stacks 1. Stack  What is a stack? An ordered list where insertions and deletions occur at one end called the top. Also known as last-in-first-out (LIFO)
Stack. Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An ADT specifies: Data stored Operations on the data.
© 2004 Goodrich, Tamassia Stacks. © 2004 Goodrich, Tamassia Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data.
Stacks. A stack is a data structure that holds a sequence of elements and stores and retrieves items in a last-in first- out manner (LIFO). This means.
30 May Stacks (5.1) CSE 2011 Winter Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An.
CS 221 Analysis of Algorithms Data Structures Vectors, Lists.
CH 6. VECTORS, LISTS, AND SEQUENCES ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH,
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
Parasol Lab, Dept. CSE, Texas A&M University
Welcome to CSCE 221 – Data Structures and Algorithms
CH 6 : VECTORS, LISTS AND SEQUENCES ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH,
CH 6 : VECTORS, LISTS AND SEQUENCES ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH,
CH 5 : STACKS, QUEUES, AND DEQUES ACKNOWLEDGEMENT: THE SLIDES ARE PREPARED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA.
CHAPTER 10.1 BINARY SEARCH TREES    1 ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 17: Linked Lists.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 18: Linked Lists.
CSC 243 – Java Programming, Spring, 2014 Week 4, Interfaces, Derived Classes, and Abstract Classes.
CSCE , SPRING 2016 INSTRUCTOR: DR. NANCY M. AMATO 1.
1 Data Organization Example 1: Heap storage management Maintain a sequence of free chunks of memory Find an appropriate chunk when allocation is requested.
© 2004 Goodrich, Tamassia Queues. © 2004 Goodrich, Tamassia Stacks2 The Queue ADT The Queue ADT stores arbitrary objects Insertions and deletions follow.
Lecture 6 of Computer Science II
C++ Programming:. Program Design Including
Lists and Iterators 5/3/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Iterators and Sequences
Data Structure By Amee Trivedi.
Stacks Stacks.
Vectors 5/31/2018 9:25 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and.
Ch7. List and Iterator ADTs
Doubly Linked Lists 6/3/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Big-O notation Linked lists
Ch. 2 Object-Oriented Programming
Maps, Hash tables, Skip Lists– Interesting problems
EEL 4854 IT Data Structures Linked Lists
Lecture 2 of Computer Science II
Object-Orientated Programming
LINKED LISTS CSCD Linked Lists.
Object-Oriented Programming
Ch7. List and Iterator ADTs
Lists and Iterators 3/9/15 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Object-Oriented Programming
Sequences 11/22/2018 3:25 AM Doubly-Linked Lists Doubly-Linked Lists.
Stacks.
Ch. 8 Priority Queues And Heaps
Linked Lists.
CH 9.2 : Hash Tables Acknowledgement: These slides are adapted from slides provided with Data Structures and Algorithms in C++, Goodrich, Tamassia and.
Doubly Linked Lists or Two-way Linked Lists
CS212D: Data Structures Week 5-6 Linked List.
CS2013 Lecture 4 John Hurley Cal State LA.
Problem Understanding
CH 9.2 : Hash Tables Acknowledgement: These slides are adapted from slides provided with Data Structures and Algorithms in C++, Goodrich, Tamassia and.
Recall What is a Data Structure Very Fundamental Data Structures
CH 9 : Maps And Dictionary
CS210- Lecture 5 Jun 9, 2005 Agenda Queues
Introduction to Data Structure
Linked Lists & Iterators
Oriented Design and Abstract Data Type
Stacks and Linked Lists
Problem Understanding
Presentation transcript:

CH 1-4 : INTRODUCTION ACKNOWLEDGEMENT: THE SLIDES ARE PREPARED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA AND MOUNT (WILEY 2004) AND SLIDES FROM NANCY M. AMATO AND JORY DENNY 1

SYLLABUS  2

OBJECT ORIENTED DESIGN (CH 2)  Object Oriented Design and Principles  Abstract Data Types  Encapsulation  Inheritance  Polymorphism  Exceptions 3

OBJECT ORIENTED DESIGN AND PRINCIPLES (CH 2.1)  Design Goals:  Robustness : Capability to handle any type of inputs  Adaptability : Can be used in various environments with minimal or no changes  Reusability : Same code can be used as a component in various applications over time  Design Principles:  Abstraction: Abstract the complicated details in form of fundamental parts and operations  Encapsulation: Coupling data with methods.  Modularity: Component based design  Inheritance: Hierarchical and “is-a type-of” relationship  Polymorphism: Ability to take different form 4

ABSTRACT DATA TYPE (ADT)  An abstract data type (ADT) is an abstraction of a data structure  An ADT specifies:  Data stored  Operations on the data  Error conditions associated with operations  Mathematical model only with no details about the implementation :  ADT specifies what each operation does not how it does it.  Example: ADT modeling a simple stock trading system  The data stored are buy/sell orders  The operations supported are  order buy(stock, shares, price)  order sell(stock, shares, price)  void cancel(order)  Error conditions:  Buy/sell a nonexistent stock  Cancel a nonexistent order 5

ENCAPSULATION  Bundling of data and associated methods as a type.  Hiding the details and direct access to the underlying data.  Class: Construct or the definition of encapsulated data and associated methods. User-defined types.  class Person { private: string name; public: string GetName() { return name; } void SetName( string _n) { name = _n; } }  Object: Instance of an object  Person A; // A is an object of class Person or in other words type of A is Person 6

INHERITANCE  Hierarchical organization of classes.  Base class: The class from which another class is inherited.  Derived class: The class that inherits  Abstract classes: Base class with one or more virtual member functions  Virtual member functions are abstract functions with no details. 7 Shape CircleTriangleSquare

POLYMORPHISM  Different types of a variable  Subtyping : Type of the variable is determined at runtime based on the instance.  Eg: Shape* newShape = new Circle(); newShape->draw(); //Will call draw() function of Circle class and not of the Shape class.  Parametric: Generics (templates) where code is written without any specific type.  Eg: template T sum ( T a, T b) {} // Can be used as sum (3,4) and sum (4.5, 7.8) 8

EXCEPTIONS (CH 2.4)  Attempting the execution of an operation of ADT may sometimes cause an error condition, called an exception  Exceptions are said to be “thrown” by an operation that cannot be executed  Example: removing an element from an empty container 9

ARRAYS AND LINKED LISTS (CH 3)  Arrays (Ch 3.1)  Singly Linked List (Ch 3.2)  Doubly Linked (Ch 3.3) 10

ARRAYS  Data structure containing a collection of same type  Contiguous allocation in memory  Limitation: The length or capacity of the array is fixed.  Easy Random Access through index of the element (position of the element with respect to the first element in the array. Eg. A[3] indicates fourth element if the first element is stored in index 0.  Insertions and deletion at arbitrary location would include rearrangement of the elements following the location. Eg. Removing an element at index 6 would involve moving elements at indices 7,8,9 to 6,7,8. 11

SINGLY LINKED LIST  A singly linked list is a concrete data structure consisting of a sequence of nodes  Each node stores  element  link to the next node  No contiguous allocation of memory  Accessing an element at an arbitrary location includes traversing the list from the first element. next elem node ABCD  12

DOUBLY LINKED LIST  A doubly linked list provides a natural implementation of the Node List ADT  Nodes implement Position and store:  element  link to the previous node  link to the next node  Special trailer and header nodes  No contiguous allocation of memory  Access at arbitrary position requires traversal of the list  Easy insertion and deletion of element  If the pointer to the element is known prevnext elem trailer header nodes/positions elements node 13