Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.

Slides:



Advertisements
Similar presentations
Overview of Data Structures and Algorithms
Advertisements

COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
Overview of Programming and Problem Solving ROBERT REAVES.
COEN 352 Data structures and Algorithms R. Dssouli.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Abstract Data Types (ADT)
Database Design Concepts Info 1408 Lecture 2 An Introduction to Data Storage.
Chapter 1 Program Design
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
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.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
CS102 Introduction to Computer Programming
The Study of Computer Science Chapter 0 Intro to Computer Science CS1510, Section 2.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Teaching Teaching Discrete Mathematics and Algorithms & Data Structures Online G.MirkowskaPJIIT.
1.1 1 Introduction Foundations of Computer Science  Cengage Learning.
CSCI-383 Object-Oriented Programming & Design Lecture 4.
Lecture No.01 Data Structures Dr. Sohail Aslam
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
The Study of Computer Science Chapter 0 Intro to Computer Science CS1510.
ITEC 2620A Introduction to Data Structures
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.
The Beauty and Joy of Computing Lecture #3 : Creativity & Abstraction UC Berkeley EECS Lecturer Gerald Friedland.
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.
1 CS 350 Data Structures Chaminade University of Honolulu.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
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 Structures Lecture 1: Introduction. Course Contents Data Types   Overview, Introductory concepts   Data Types, meaning and implementation  
Lecture 11 Data Structures, Algorithms & Complexity Introduction Dr Kevin Casey BSc, MSc, PhD GRIFFITH COLLEGE DUBLIN.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
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.
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.
Objective You will be able to define the basic concepts of object-oriented programming with emphasis on objects and classes by taking notes, seeing examples,
DATA STRUCTURES (CS212D) Overview & Review Instructor Information 2  Instructor Information:  Dr. Radwa El Shawi  Room: 
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
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.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Computer Systems Architecture Edited by Original lecture by Ian Sunley Areas: Computer users Basic topics What is a 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.
Mohammed I DAABO COURSE CODE: CSC 355 COURSE TITLE: Data Structures.
Advanced Data Structures Lecture 1
Introduction toData structures and Algorithms
Advanced Algorithms Analysis and Design
Introduction to Algorithms
GC211Data Structure Lecture2 Sara Alhajjam.
Lecture 2 of Computer Science II
Objective of This Course
Data Structures: Introductory lecture
Week # 1: Overview & Review
ITEC 2620M Introduction to Data Structures
Introduction to Algorithms
CompSci 1: Principles of Computer Science Lecture 1 Course Overview
Presentation transcript:

Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1

Quotes

Motivation The primary purpose of most computer programs is not to perform calculations, but to store and retrieve information — usually as fast as possible. For this reason, the study of data structures and the algorithms that manipulate them is at the heart of computer science.

Data Structures: Costs and Benefits Each data structure has associated costs and benefits. No data structure is better than another for use in all situations. Otherwise inferiors will usually have long been forgotten. A data structure requires a certain amount of space for each data item it stores, a certain amount of time to perform a single basic operation, and a certain amount of programming effort. Each problem has constraints on available space and time. Each solution to a problem makes use of the basic operations in some relative proportion, and the data structure selection process must account for this Only after a careful analysis of your problem’s characteristics can you determine the best data structure for the task.

Examples Bank Transaction Model – Open account, close account, add money and withdraw money – Human Tellers and Automatic Teller Machines (ATM) – Account opening is slow process – Money withdrawal and adding must be fast – Account close must be done offline – Hash Tables is a data structure that offers similar characteristics

Steps for Selecting Data Structure 1. Analyze your problem to determine the basic operations that must be supported. Examples of basic operations include inserting a data item into the data structure, deleting a data item from the data structure, and finding a specified data item. 2. Quantify the resource constraints for each operation. 3. Select the data structure that best meets these requirements.

Terminologies Type: a collection of values, e.g. Boolean type consist of values true and false – Simple Type: values contain no sub-parts, e.g. integer – Composite Type: values contain sub-parts e.g. bank record Data Item: a piece of information or record whose value is drawn from a type. A data item is said to be a member type

Terminologies Data Type: a type together with a collection of operations to manipulate the type. – For example, an integer variable is a member of the integer data type. – Addition is an example of an operation on the integer data type. Abstract Data Type: realization of a data type as a software component – An ADT does not specify how the data type is implemented – The implementation details are hidden from the user of the ADT and protected from outside access, a concept referred to as encapsulation

Terminologies Data Structure: implementation for an ADT. In an object-oriented language such as Java, an ADT and its implementation together make up a class. Each operation associated with the ADT is implemented by a member function or method. The variables that define the space required by a data item are referred to as data members

Example Primary activities of any passenger car are: – Steering – Accelerating – Braking Design for cars can be viewed as an ADT with operations “steer,” “accelerate,” and “brake.” Two cars might implement these operations in radically different ways, say with different types of engine, or front- versus rear-wheel drive. Yet, most drivers can operate many different cars because the ADT presents a uniform method of operation that does not require the driver to understand the specifics of any particular engine or drive design

Abstraction Concept of an ADT is one instance of an important principle that must be understood by any successful computer scientist: managing complexity through abstraction. Humans deal with complexity by assigning a label to an assembly of objects or concepts and then manipulating the label in place of the assembly

Abstraction: Example We apply the label “hard drive” to a collection of hardware that manipulates data on a particular type of storage device we apply the label “CPU” to the hardware that controls execution of computer instructions. These and other labels are gathered together under the label “computer.” Because even the smallest home computers today have millions of components, some form of abstraction is necessary to comprehend how a computer operates

Logical and Physical Data Type Data types have both a logical and a physical form. The definition of the data type in terms of an ADT is its logical form. The implementation of the data type as a data structure is its physical form

Example A particular Java environment might provide a library that includes a list class. The logical form of the list is defined by the public functions, their inputs, and their outputs that define the class. This might be all that you know about the list class implementation. Within the class, a variety of physical implementations for lists is possible

Problem, Algorithm and Computer Program Problem – A problem is a task to be performed. – It is best thought of in terms of inputs and matching outputs. – A problem definition should not include any constraints on how the problem is to be solved. – A problem definition should include constraints on the resources that may be consumed by any acceptable solution

Problem, Algorithm and Computer Program An Analogy of Problem – It can be viewed as functions in the mathematical sense. – A function is a matching between inputs (the domain) and outputs (the range). – The values making up an input are called the parameters of the function. – A specific selection of values for the parameters is called an instance of the problem.

Problem, Algorithm and Computer Program A Sorting Problem: Input: a sequence of n number  a 1, a 2, …,a n  Output: a permutation (reordering)  a 1 ', a 2 ', …,a n '  such that a 1 '  a 2 '  …  a n '.

Problem, Algorithm and Computer Program Algorithm – An algorithm is a method or a process followed to solve a problem. – If the problem is viewed as a function, then an algorithm is an implementation for the function that transforms an input to the corresponding output. – A problem can be solved by many different algorithms. – The advantage of knowing several solutions to a problem is that solution A might be more efficient than solution B for a specific variation of the problem

Problem, Algorithm and Computer Program Characteristics of Algorithm – It must be correct – It is composed of a series of concrete steps – It must be composed of a finite number of steps – It must terminate

Problem, Algorithm and Computer Program Programs – A computer program as an instance, or concrete representation, of an algorithm in some programming language – Algorithms are intended for humans to understand while programs are intended for compliers/ interpreters for interpretation

Objectives of this Course The first is to present the commonly used data structures – To built programmer’s basic data structure “toolkit.” For many problems, some data structure in the toolkit provides a good solution. To introduce the idea of tradeoffs and reinforce the concept that there are costs and benefits associated with every data structure – This is done by describing, for each data structure, the amount of space and time required for typical operations.

Objectives of this Course To introduce important algorithms like sorting, searching To teach how to measure the effectiveness of a data structure or algorithm. – Only through such measurement can you determine which data structure in your toolkit is most appropriate for a new problem – The techniques presented also allow you to judge the merits of new data structures that you or others might invent.

Course Overview

Books and Tools Text Book: Data Structure and Algorithms in Java by Robert Lafore Reference Book: Data Structure and Problem Solving using Java by Mark Allen Weiss Java and Netbeans