CSEC 1 Algorithms and Data Structures 1 lecturer

  • Slides: 12
Download presentation
CSE–C 1 Algorithms and Data Structures 1 • lecturer Dr. Matthew Montebello • office

CSE–C 1 Algorithms and Data Structures 1 • lecturer Dr. Matthew Montebello • office CB 409 • e-mail mmont@cs. um. edu. mt • credit 1 • lectures 10 • assignment 1 (50%) • test 1 (50%) • webpage http: //staff. um. edu. mt/mmon 1/lectures/dip_cs_edu

Lecture Schedule 1. Introduction to CSE-C 1. 2. Abstract Data Types (ADTs) 3. Lists.

Lecture Schedule 1. Introduction to CSE-C 1. 2. Abstract Data Types (ADTs) 3. Lists. 4. Stacks. 5. Queues. 6. Deques. Assign. Out 7. Trees. 8. Sets. 9. Past Papers & other Queries. 10. Closure – Pre-Test Revision. Assign. In

Introduction to CSE-C 1 • What will happen during lectures. • Practice makes perfect.

Introduction to CSE-C 1 • What will happen during lectures. • Practice makes perfect. • Web pages of interest: ; http: //pascal. about. com/compute/ pascal/library/weekly/aa 011901. htm ; http: //taoyue. com/tutorials/pascal ; http: //www. cs. virginia. edu/~mab 8 e/ structures. html ; http: //allserv. rug. ac. be/~vfack/files/ algori. html • Use of Compiler. • Other procedures.

2. Abstract Data Types Today’s lecture: 1. Overview of schedule 2. Recall of last

2. Abstract Data Types Today’s lecture: 1. Overview of schedule 2. Recall of last lecture 3. General introd. to DS & Algs. 4. DS in everyday life 5. Introduction to ADTs 6. Overview of ADTs covered 7. Normal processes of an ADT 8. Closure – Summary 9. Next Lecture 10. Questions.

General Introd. to DS & Algs A Data Structure is an Abstract Data Type

General Introd. to DS & Algs A Data Structure is an Abstract Data Type that has three following components: 1. Operations: Specifications of external appearance of a data structure 2. Storage Structures: Organizations of data implemented in lower level data structures 3. Algorithms: Description on how to manipulate information in the storage structures to obtain the results defined for the operations

General Introd. to DS & Algs An algorithm is a finite set of instructions

General Introd. to DS & Algs An algorithm is a finite set of instructions chosen from a finite, fixed set of instructions. Every algorithm must satisfy the following criteria. 1. Input: It has zero or more input parameters. 2. Output: It produces at least one output parameter. 3. Definiteness: Each instruction must be clear and unambiguous. 4. Finiteness: For every input, it executes only a finite number of instructions. 5. Effectiveness: Every instruction must be sufficiently basic so that a machine can execute the instruction.

DS in Everyday Life We use DS in the normal things we do during

DS in Everyday Life We use DS in the normal things we do during the day, like: • Shopping list • List of Shores • Telephone directory Same thing with algorithms, we implicitly define our own set of instructions on how we manipulate these daily DS, like: • Add/removing items • Prioritizing items • Data to enter with each item

Introduction to ADTs Definition of Abstract Data Type Class of data objects (i. e.

Introduction to ADTs Definition of Abstract Data Type Class of data objects (i. e. , instances of the data type) with a set of the operations that can be applied to the objects (telling what to do instead of how to do) ADT is specified by 1. a set of operations which can be applied to the objects and 2. a set of properties (called axioms) which all the objects and operations must satisfy.

Introduction to ADTs Advantage of Abstract Data Type • Modularity (Encapsulation) The definition of

Introduction to ADTs Advantage of Abstract Data Type • Modularity (Encapsulation) The definition of operations isolates implementation of ADT from construction of a program using ADT. • Cohesiveness (Selfmaintaining) Implementation of ADT can be changed without modifying programs using ADT. • Data Abstraction (minimal Coupling) The ADT does not depend on other processes during input or output.

Introduction to ADTs Simple example of ADT Name of ADT : Integer Operations that

Introduction to ADTs Simple example of ADT Name of ADT : Integer Operations that it will perform • Create: Defines an identifier with an undefined value • Assign: Assigns the value of one integer identifier or value to another integer identifier • Is. Equal: returns true if the values (or values associated with identifiers) of the two integers are the same • Less. Than: returns true if the value of the first integer is less than the value of the second integer • Negative: returns the negative of the integer value • Sum: returns the sum of two integer values

Overview of ADTs covered As already discussed and as seen in the schedule we

Overview of ADTs covered As already discussed and as seen in the schedule we will be covering in some detail the following DS based on the concept of ADT: • Lists. • Stacks. • Queues. • Deques. • Trees. • Sets. • Tables

Normal Process of an ADT The standard operations that we will be doing with

Normal Process of an ADT The standard operations that we will be doing with each of the DS we will be covering will be explained in theory and programmed in the Pascal language. Operations include: • Define • Create • Add to • Remove from • Check if full • Search • Check if empty • Empty • Destroy