Abstract Data Types (ADT)

Slides:



Advertisements
Similar presentations
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
Advertisements

COEN 352 Data structures and Algorithms R. Dssouli.
© Janice Regan, CMPT 102, Sept CMPT 102 Introduction to Scientific Computer Programming The software development method algorithms.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
The Design and Analysis of Algorithms
Coursenotes CS3114: Data Structures and Algorithms Clifford A. Shaffer Yang Cao Department of Computer Science Virginia Tech Copyright ©
Introduction - The Need for Data Structures Data structures organize data –This gives more efficient programs. More powerful computers encourage more complex.
1 A Introduction to Data Structures and Algorithm Analysis Data Structures Asst. Professor Kiran Soni.
DATA STRUCTURE Subject Code -14B11CI211.
Data Structures 1- Course Syllabus. 2- Introduction about Data Structures.
Introduction to Programming (in C++) Introduction Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC.
Lecture No.01 Data Structures Dr. Sohail Aslam
Dr. Engr. Sami ur Rahman Assistant Professor Department of Computer Science University of Malakand Data Structure: Introduction.
Instructor Information: Dr. Radwa El Shawi Room: Week # 1: Overview & Review.
DATA STRUCTURES (CS212D) Week # 1: Overview & Review.
CS212: DATA STRUCTURES Lecture 1: Introduction. What is this course is about ?  Data structures : conceptual and concrete ways to organize data for efficient.
Prepared By Ms.R.K.Dharme Head Computer Department.
Analyzing algorithms & Asymptotic Notation BIO/CS 471 – Algorithms for Bioinformatics.
Lists. Container Classes Many applications in Computer Science require the storage of information for collections of entities e.g. a student registration.
1 CSC 222: Computer Programming II Spring 2004 See online syllabus at: Course goals:
1 CS 350 Data Structures Chaminade University of Honolulu.
Course notes CS2606: Data Structures and Object-Oriented Development Ryan Richardson John Paul Vergara Department of Computer Science Virginia Tech Spring.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Data Structures and Algorithms Introduction to Algorithms M. B. Fayek CUFE 2006.
Introduction to Data Structures and Algorithms CS 110: Data Structures and Algorithms First Semester,
Data Structures and Algorithms Lecture 3 Instructor: Quratulain Date: 8 th September, 2009.
Chapter 1 Data Structures and Algorithms. Primary Goals Present commonly used data structures Present commonly used data structures Introduce the idea.
Data Structures and Algorithms Lecture 1 Instructor: Quratulain Date: 1 st Sep, 2009.
Data Structure Introduction.
Data Structures Lecture 1: Introduction. Course Contents Data Types   Overview, Introductory concepts   Data Types, meaning and implementation  
Algorithm Analysis CS 400/600 – Data Structures. Algorithm Analysis2 Abstract Data Types Abstract Data Type (ADT): a definition for a data type solely.
Lecture 11 Data Structures, Algorithms & Complexity Introduction Dr Kevin Casey BSc, MSc, PhD GRIFFITH COLLEGE DUBLIN.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Data Structures and Algorithms IT12112
CS404 Design and Analysis of Algorithms BBy DDr. M V S Peri Sastry BB.E, PhD(BITS-Pilani)
1 CS 311 Data Structures. 2 Instructor Name : Vana Doufexi Office : 2-229, Ford Building Office hours: By appointment.
Data Structures & Algorithms CHAPTER 1 Introduction Ms. Manal Al-Asmari.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
DATA STRUCTURES (CS212D) Overview & Review Instructor Information 2  Instructor Information:  Dr. Radwa El Shawi  Room: 
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
1 A Practical Introduction to Data Structures and Algorithm Analysis Chaminade University of Honolulu Department of Computer Science Text by Clifford Shaffer.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
南昌大学自动化系胡凌燕 1 Charpter 1 The data structures and algorithms (p3) There are often many approaches to solving a problem. How do we choose between them? 
Maitrayee Mukerji. INPUT MEMORY PROCESS OUTPUT DATA INFO.
Lecture 1 Data Structures Aamir Zia. Introduction Course outline Rules and regulations Course contents Good Programming Practices Data Types and Data.
AS Level Computing 8 CHAPTER: Fundamentals of structured programming The basics of good programming Algorithms System Flow Charts Symbol Conventions Steps.
Mohammed I DAABO COURSE CODE: CSC 355 COURSE TITLE: Data Structures.
Advanced Data Structures Lecture 1
Introduction toData structures and Algorithms
Introduction to Algorithms
CSC 222: Object-Oriented Programming
CSC 222: Object-Oriented Programming
The Design and Analysis of Algorithms
Data Structures and Algorithms
GC211Data Structure Lecture2 Sara Alhajjam.
DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++
CSC 222: Object-Oriented Programming
Courtsey & Copyright: DESIGN AND ANALYSIS OF ALGORITHMS Courtsey & Copyright:
Data Structures (CS212D) Overview & Review.
Chapter 11: File System Implementation
Introduction to Computer Programming
Objective of This Course
Data Structures: Introductory lecture
Week # 1: Overview & Review
Introduction to Algorithms
Discrete Mathematics and its Applications
Introduction to Data Structure
Introduction to Computer Systems
Presentation transcript:

Abstract Data Types (ADT) TECHNICAL UNIVERSITY OF CRETE DEPT OF ELECTRONIC AND COMPUTER ENGINEERING DATA STRUCTURES AND FILE STRUCTURES Euripides G.M. Petrakis http://www.intelligence.tuc.gr/~petrakis Chania, 2007 E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Introduction We study data structures and we learn how to write efficient programs this hasn’t to do with programming tricks but rather with good organization of information and good algorithms that save computer memory and running time E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Data Structures Representation of data in the memory file structure: representation of data on the disk e.g., collection of records (list, tree, etc) Efficient programs require efficient data structures a problem has to be solved within the given time and space constraints E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Problem Constraints Each problem puts constraints on time and space e.g., bank example: start account: a few minutes transactions: a few seconds close account: overnight A solution is efficient if it solves the problem within its space and time constraints Cost of solution: amount of resources consumed E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Goals of this course Teach data structures for main memory and disk Teach algorithms for different tasks and data structures Teach the idea of trade-offs there are costs and benefits associated with each data structure and each algorithm Teach how to measure effectiveness of each algorithm and data structure E.G.M. Petrakis Abstract Data Types (ADT)

Selecting Data Structures Analyze the problem to determine the resource constraints a solution must meet Determine the operations that must be supported e.g., record search, insertion, deletion etc. Quantify the constraints for each operation e.g., search operations must be very fast Select data structure that best meet these requirements E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Costs & Benefits Each data structure requires: space for each data item it stores time to perform each operation programming effort to implement it Each data structure has costs and benefits rarely one data structure is better than another in all situations one may permit faster search (or insertion or deletion) operations than another are all operations the same important? E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Type (ADT) ADT: definition of a data type in terms of a set of values and a set of operations allowed on that data type. Each ADT operation is defined by its inputs and outputs ADTs hide implementation details A data structure is the implementation of an ADT operations associated with the ADT are implemented by one or more functions E.G.M. Petrakis Abstract Data Types (ADT)

Logical and Physical forms Data items have both a logical and a physical form Logical form: definition of the data item within an ADT e.g., integers in mathematical sense: +, - Physical form: implementation of the data item e.g., 16 or 32 bit integers E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) ADT:Type + Operations Data Items: Logical Form Data Structure: Storage Space + functions Data Items: Physical Form E.G.M. Petrakis Abstract Data Types (ADT)

ADT String: Sequence of chars ADT function length (s: string): integer; post condition : length = len(s); ADT function concat (s1,s2: string): string; post condition: concat = s1 + s2; ADT function substr (s: string, i, j: integer): string; precondition: 0 < i < len(s), 0 < j < len(s) – i + 1 post condition: substr(s, i, j); ADT function pos (s1, s2): integer; precondition … post condition … E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Definition of an ADT Depends on the application Different definitions for the same application An ADT hides implementation details different implementations for the same ADT When the ADT is given, its data type can be used by the programmer e.g., string, math libraries in C when the implementation changes the programs need not be changed E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Algorithms The method that solves a problem An algorithm takes the input to a problem and transforms it to the output a mapping of input to output a problem can have many algorithms A program is the implementation of an algorithm in some programming language E.G.M. Petrakis Abstract Data Types (ADT)

Properties of Algorithms Effectiveness: the algorithm can be written as a program there are problems for which no algorithm exists Correctness: finds the correct solution for every input Termination: terminates after a finite number of steps each step requires a finite amount of time Efficiency: makes efficient use of the computer’s resources Complexity: it must be easy to implement, code and debug E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Tiling Problem The algorithm inputs a finite set T of tiles it is assumed that an unlimited number of cards of each type is available asks whether any finite area, of any size, can be covered using tiles in T so that the colors in any two touching edges are the same For any algorithm there can be inputs T for which the algorithm never terminates or finds a wrong answer E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Tile tile types that can tile any area Tile tile types that cannot tile any area From “Algorithmics”, David Harel, E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) A Termination Problem An algorithm must terminate with the correct solution for any input No one has been able to prove that the algorithm terminates for any positive n although most people believe that it does!! int OddEven( int n ) { while ( n > 1 ) if (( n % 2 ) == 0) n = n / 2; else n = 3n + 1; return n; } E.G.M. Petrakis Abstract Data Types (ADT)

Taxonomy of Algorithms An algorithmic problem that admits no algorithm is termed “non-computable” If it is a decision problem it is termed “undecidable” E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Disk Model T = Taccess + Trotation + Tread Block: unit memory size for disk size of data transferred in main memory per disk access In most cases page=block=track e.g., 1, 2, 4, 8Kbytes E.G.M. Petrakis Abstract Data Types (ADT)

Abstract Data Types (ADT) Disk Model (cont.) Taccess > Trotation > Tread  increase the amount of data which is transferred to the main memory per disk access large blocks, compression, data in memory in multi-user systems, the disk head can be anywhere distance covered by disk head time E.G.M. Petrakis Abstract Data Types (ADT)