ADTs and C++ Ch 2,3,4 May 12, 2015 Abstract Data Type (ADT) An abstract data type is: 1.A collection of data items (storage structures) 2.Basic operations.

Slides:



Advertisements
Similar presentations
Hash Tables Many of the slides are from Prof. Plaisteds resources at University of North Carolina at Chapel Hill.
Advertisements

Comp 122, Spring 2004 Hash Tables – 1. hashtables - 2 Lin / Devi Comp 122, Fall 2003 Dictionary Dictionary: »Dynamic-set data structure for storing items.
Data Structures.
COL 106 Shweta Agrawal and Amit Kumar
Overview of Data Structures and Algorithms
COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
Data Structures Using C++ 2E
Dictionaries and Their Implementations Chapter 18 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013.
Chapter 1 Object Oriented Programming. OOP revolves around the concept of an objects. Objects are crated using the class definition. Programming techniques.
Processing Data in External Storage CS Data Structures Mehmet H Gunes Modified from authors’ slides.
1 Problem Solving Abstraction Oftentimes, different real-world problems can be modeled using the same underlying idea Examples: Runtime storage, Undo operation.
CS 307 Fundamentals of Computer Science 1 Abstract Data Types many slides taken from Mike Scott, UT Austin.
hashing1 Hashing It’s not just for breakfast anymore!
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 17: Linked Lists.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Chapter 1 Principles of Programming and Software Engineering.
Basic Definitions Data Structures: Data Structures: A data structure is a systematic way of organizing and accessing data. Or, It’s the logical relationship.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
C++ Programming: Program Design Including Data Structures, Fifth Edition Chapter 17: Linked Lists.
Abstract Data Type (ADT). 2 An Abstract Data Type (ADT) is a data structure with a set of operations –Operations specify how the ADT behaves, but does.
Introducing Hashing Chapter 21 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Basic Concepts Chapter 1 Objectives
Introduction - The Need for Data Structures Data structures organize data –This gives more efficient programs. More powerful computers encourage more complex.
Data Structures 1- Course Syllabus. 2- Introduction about Data Structures.
1 Hash Tables  a hash table is an array of size Tsize  has index positions 0.. Tsize-1  two types of hash tables  open hash table  array element type.
Chapter 3 List Stacks and Queues. Data Structures Data structure is a representation of data and the operations allowed on that data. Data structure is.
Data Structures and Abstract Data Types "Get your data structures correct first, and the rest of the program will write itself." - David Jones.
Computer Science Department Data Structures and Algorithms Lecture 1.
Comp 245 Data Structures Linked Lists. An Array Based List Usually is statically allocated; may not use memory efficiently Direct access to data; faster.
SEARCHING. Vocabulary List A collection of heterogeneous data (values can be different types) Dynamic in size Array A collection of homogenous data (values.
111 © 2002, Cisco Systems, Inc. All rights reserved.
Prepared By Ms.R.K.Dharme Head Computer Department.
1 21 COP 3540 Data Structures with OOP Overview: Chapter 1.
A Binary Search Tree Binary Search Trees.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Standard Template Library (STL)
Chapter 9 (modified) Abstract Data Types and Algorithms Nell Dale John Lewis.
Chapter 9 Abstract Data Types and Algorithms Nell Dale John Lewis.
Data Design and Implementation. Definitions of Java TYPES Atomic or primitive type A data type whose elements are single, non-decomposable data items.
ABSTRACT DATA TYPES Data types, data structures, abstract data types, Java/C++ classes, C++ structs.
COSC2007 Data Structures II Chapter 12 Tables & Priority Queues I.
Data Structures and Algorithms Lecture 1 Instructor: Quratulain Date: 1 st Sep, 2009.
Hashing Hashing is another method for sorting and searching data.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Objectives At the end of the class, students are expected to be able to do the following: Understand the searching technique concept and the purpose of.
Views of Data Data – nouns of programming world the objects that are manipulated information that is processed Humans like to group information Classes,
The ADT Table The ADT table, or dictionary Uses a search key to identify its items Its items are records that contain several pieces of data 2 Figure.
1 CSC 427: Data Structures and Algorithm Analysis Fall 2006 See online syllabus (also available through Blackboard): Course goals:
Collections Data structures in Java. OBJECTIVE “ WHEN TO USE WHICH DATA STRUCTURE ” D e b u g.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
Data Structure Introduction Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2010.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
Abstract Data Type EnhanceEdu.
2 Obaid Ullah HOD Computer Science Dept. Superior University Sialkot Campus.
Dictionaries and Their Implementations Chapter 18 Data Structures and Problem Solving with C++: Walls and Mirrors, Frank Carrano, © 2012.
Hash Tables ADT Data Dictionary, with two operations – Insert an item, – Search for (and retrieve) an item How should we implement a data dictionary? –
Introduction to Objects and Encapsulation Computer Science 4 Mr. Gerb Reference: Objective: Understand Encapsulation and abstract data types.
Chapter 2 Principles of Programming and Software Engineering.
Unit 1 - Introducing Abstract Data Type (ADT) Part 1.
Data Structures Dr. Abd El-Aziz Ahmed Assistant Professor Institute of Statistical Studies and Research, Cairo University Springer 2015 DS.
Array Array is a variable which holds multiple values (elements) of similar data types. All the values are having their own index with an array. Index.
structures and their relationships." - Linus Torvalds
structures and their relationships." - Linus Torvalds
Introduction to Data Structure
structures and their relationships." - Linus Torvalds
Lecture 3 – Data collection List ADT
Abstract Data Types (ADTs)
Presentation transcript:

ADTs and C++ Ch 2,3,4 May 12, 2015

Abstract Data Type (ADT) An abstract data type is: 1.A collection of data items (storage structures) 2.Basic operations that can be performed on these items (algorithms) Called abstract because the represented data and the algorithms that operate on it are independent of the implementation (data abstraction) Thinking about what can be done with the data, not how it is done

Example Dictionary – A set of items indexed by keys Primary operations Search(S,k) - Given a set S and a key value k, returns a pointer x to an element in S whose key is k, if it exists Insert(S,x) - Add x to the set S Delete(S,x) - Given a pointer x to an element in the set S, remove x from S.

Example The actual data stored in the dictionary could be organized in any way How it is stored has no bearing on the way it is used Dictionary Implementations 1.Unsorted Array 2.Sorted Array 3.Singly-Linked Unsorted List 4.Doubly-Linked Unsorted List 5.Singly-Linked Sorted List 6.Doubly-Linked Sorted List 7.Binary Search Tree 8.Balanced Binary Search Tree 9.Hash Tables

C++ C++ is a particularly convenient choice to express the algorithms we will encounter. C++ is an extension of the popular C language. Most of the new features incorporated into C++ facilitate the understanding and implementation of data structures.

C++ Among the most important features of C++ for our study of data structures are: Data abstraction: programmers can create new types to represent whatever collections of data are convenient for their applications. Object-oriented design: the programmer-defined types play a central role in the implementation of algorithms. Use of the top-down approach Facilitation of code reuse, and the construction of general purpose libraries.

C++ Among the most important features of C++ for our study of data structures are: Includes an extensive, efficient, and convenient standard library. Improves on several of the inconvenient and dangerous aspects of C. Maintains, to a good degree, the efficiency that is the hallmark of the C language.

Classes as ADTs We can use a C++ class so long as we know the specifications of each of its methods That is, statements of precisely what each method does. We do not need to know how Data are actually stored Methods are actually programmed An important programming strategy known as information hiding

Classes as ADTs When the time comes to implement a class, we find that more goes on behind the scenes We need to decide what variables are needed how to store the data what functions are needed to manipulate this data All these variables and functions, however, are private to the class

Classes as ADTs A client program does not need to know what the private members are know how they are programmed have any access to them Instead, a client program only needs the public methods that are specified and declared for the class.