ABSTRACT DATA TYPES Data types, data structures, abstract data types, Java/C++ classes, C++ structs.

Slides:



Advertisements
Similar presentations
Copyright © 2002 Pearson Education, Inc. Slide 1.
Advertisements

Chapter 6 Structures and Classes. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 6-2 Learning Objectives Structures Structure types Structures.
Data Structure & Abstract Data Type
1 Structures. 2 User-Defined Types C provides facilities to define one’s own types. These may be a composite of basic types ( int, double, etc) and other.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Abstract Data Types Data abstraction, or abstract data types, is a programming methodology where one defines not only the data structure to be used, but.
Chapter 9 Imperative and object-oriented languages 1.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
1 Chapter 11 Structured Types, Data Abstraction and Classes Dale/Weems/Headington.
Prepared by Dr. Inayatullah Shah1 Data Structures CSC212.
1 Data Structures CSC Data Types & Data Structures Applications/programs read, store and operate on data. Finally output results. What is data?
1 Data Structures: Introduction CSC Data Types & Data Structures Applications/programs read data, store data temporarily, process it and finally.
1 Lecture 29 Chapter 11 Structured Types, Data Abstraction and Classes Dale/Weems/Headington.
Rossella Lau Lecture 5, DCO10105, Semester B, DCO10105 Object-Oriented Programming and Design  Lecture 5: Class construction  Encapsulation 
Lecture 9 Concepts of Programming Languages
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.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
Basic Concepts Chapter 1 Objectives
1 Classes and Data Abstraction Andrew Davison Noppadon Kamolvilassatian Department of Computer Engineering Prince of Songkla University.
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.
Programming Languages and Paradigms Object-Oriented Programming.
Data Structures Winter What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important.
Chapter 6 Structures and Classes. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 6-2 Structures  2 nd aggregate data type: struct  Recall:
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.
Dale Roberts Object Oriented Programming using Java - Packages Dale Roberts, Lecturer Computer Science, IUPUI Department.
More with Methods (parameters, reference vs. value, array processing) Corresponds with Chapters 5 and 6.
Computer Science Department Data Structures and Algorithms Lecture 1.
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.
CSE 12 – Basic Data Structures Cynthia Bailey Lee Some slides and figures adapted from Paul Kube’s CSE 12 CS2 in Java Peer Instruction Materials by Cynthia.
Understanding Structures tMyn1 Understanding Structures In order to describe virtually anything in the real world, you need to define several values that.
1 Using Structures and Classes COSC 1557 C++ Programming Lecture 4.
GUIDED BY- A.S.MODI MADE BY- 1. SHWETA ALWANI 2. PRIYANKA.
P Chapter 2 introduces Object Oriented Programming. p OOP is a relatively new approach to programming which supports the creation of new data types and.
1 Jeff Edmonds York University COSC 2011 Lecture 2 Abstract Positions/Pointers Positions in an Array Pointers in C References in Java Implementing Positions.
Data Structures TREES.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
APS105 Lists. Structures Arrays allow a collection of elements –All of the same type How to collect elements of different types? –Structures; in C: struct.
Classes and Data Abstraction Andrew Davison Noppadon Kamolvilassatian Department of Computer Engineering Prince of Songkla University 1
ADT data abstraction. Abstraction  representation of concepts by their relevant features only  programming has two major categories of abstraction process.
Chapter 16 – Data Structures and Recursion. Data Structures u Built-in –Array –struct u User developed –linked list –stack –queue –tree Lesson 16.1.
Programming Abstractions Cynthia Lee CS106X. Topics:  Priority Queue › Linked List implementation › Heap data structure implementation  TODAY’S TOPICS.
Recitation 7 Collections. Array List and Linked List Array List and Linked List are implementations of the same interface: List. As a result, they have.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
1 Classes II Chapter 7 2 Introduction Continued study of –classes –data abstraction Prepare for operator overloading in next chapter Work with strings.
1 CS Programming Languages Class 22 November 14, 2000.
1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 10 Abstraction - The concept of abstraction is fundamental in programming - Nearly all programming.
Slide 1 Chapter 6 Structures and Classes. Slide 2 Learning Objectives  Structures  Structure types  Structures as function arguments  Initializing.
Object Oriented Programming. OOP  The fundamental idea behind object-oriented programming is:  The real world consists of objects. Computer programs.
Defining Classes I Part B. Information hiding & encapsulation separate how to use the class from the implementation details separate how to use the class.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 18 List ADT Animated Version.
ENEE150 – 0102 ANDREW GOFFIN Abstract Data Types.
CSC 243 – Java Programming, Spring, 2014 Week 4, Interfaces, Derived Classes, and Abstract Classes.
CPSC 252 ADTs and C++ Classes Page 1 Abstract data types (ADTs) An abstract data type is a user-defined data type that has: private data hidden inside.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
CSC 243 – Java Programming, Fall, 2008 Tuesday, September 30, end of week 5, Interfaces, Derived Classes, and Abstract Classes.
CSIS 123A Lecture 1 Intro To Classes Glenn Stevenson CSIS 113A MSJC.
Code: BCA302 Data Structures with C Prof.(Dr.) Monalisa Banerjee By.
Structures and Classes
Prepared by Dr. Inayatullah Shah
Pointers and References
Data Structures and Database Applications Abstract Data Types
Pointers and References
Trees and Binary Trees.
Tree A tree is a data structure in which each node is comprised of some data as well as node pointers to child nodes
Data Structures: Introduction
Introduction to Data Structure
NAME 436.
Data Structures and ADTs
Data Structures: Introduction
Presentation transcript:

ABSTRACT DATA TYPES Data types, data structures, abstract data types, Java/C++ classes, C++ structs

DATA TYPE A data type of a variable in a programming language refers to the set of values that the variable can take. Example 1: int x; x takes on values from to Example 2: typedef double height; height h; h takes on values from -DBL_MAX to DBL_MAX

SIMPLE & AGGREGATE DATA TYPES A simple data type is primitive or scalar data type that takes values from only one set. The simple data type is either built-in (primitively supplied by) the programming language, or is a user- defined simple data type. Examples: built-in: int, double user-defined: height

SIMPLE & AGGREGATE DATA TYPES An aggregate data type is an n-tuple of many kinds of simple- or aggregate data types, or a sequence (array) of one kind of simple- or aggregate data type. Example: n-tuple: struct point { double x;double y; int color[3]; }; sequence or array: int a[200]; sequence or array: struct point p[100];

DATA STRUCTURES A data structure is data type that is either simple or aggregate, built-in or user-defined, or an organized collection of these, with pointers connecting members of the collection. Example: A binary tree is a collection of nodes (structs), where each node has zero, one, or two pointers to children.

Data structures: Binary tree example Each node is a struct with pointer members

ABSTRACT DATA TYPE An abstract data type (ADT) consists of a data structure, together with operations (functions or methods) for accessing and modifying the data structure. The individual elements of the data structure of the ADT are called member data, and the operations of the ADT are called member functions.

ADT & Information Hiding The ADT implements information hiding: although the programmer- creator of the ADT knows all the details about the member data and member functions, the programmer-user of the ADT need not know the details of the member data and must use the member functions supplied by the creator to access and modify the data structure.

Implementation of ADTs Classes and structs: ADTs are implemented in Java using classes, and in C++ using classes and structs. In Java and C++, members of a class are private (hidden) by default. In C++, members of a struct are public by default.

Classes and structs: Access to members Private members of a class or struct may only be accessed by member functions, which are normally written by and known only to the programmer-creator of the class or struct.

Classes and structs: Access to members Programmer-users of the class or struct can only access public members, and so the creator must provide enough public member data and functions to make the class or struct useful to others, without sacrificing “privacy” of the class or struct.