90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.

Slides:



Advertisements
Similar presentations
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Advertisements

Written by: Dr. JJ Shepherd
George Blank University Lecturer.
Chapter 1. The Phases of Software Development. Data Structure 2 Chapter outline  Objectives  Use Javadoc to write a method’s complete specification.
Object Oriented Design An object combines data and operations on that data (object is an instance of class) data: class variables operations: methods Three.
Software Engineering and Design Principles Chapter 1.
Reviews for Exam 1 Chapter 1-4 CSc 212 Data Structures, Sec FG CCNY, Fall 2010.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
1 Specifying Object Interfaces. 2 Major tasks in this stage: --are there any missing attributes or operations? --how can we reduce coupling, make interface.
Software Testing and Quality Assurance
Reviews for Exam 1 Chapter 1-4 CS 211 Data Structures MHC, 2007.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Programming Languages Structure
Administrivia- Introduction CSE 373 Data Structures.
Cmp Sci 187: Midterm Review Based on Lecture Notes.
Describing Syntax and Semantics
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.
Subclasses and Subtypes CMPS Subclasses and Subtypes A class is a subclass if it has been built using inheritance. ▫ It says nothing about the meaning.
Data Structures and Programming.  John Edgar2.
Introduction CSE 1310 – Introduction to Computers and Programming
Review for Midterm Chapter 1-9 CSc 212 Data Structures.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
Java: Chapter 1 Computer Systems Computer Programming II.
Introduction Ellen Walker CPSC 201 Data Structures Hiram College.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
CS Fall 2007 Dr. Barbara Boucher Owens. CS 2 Text –Main, Michael. Data Structures & Other Objects in Java Third Edition Objectives –Master building.
Chapter 7 Stacks. © 2004 Pearson Addison-Wesley. All rights reserved 7-2 The Abstract Data Type: Developing an ADT During the Design of a Solution Specifications.
Low-Level Detailed Design SAD (Soft Arch Design) Mid-level Detailed Design Low-Level Detailed Design Design Finalization Design Document.
Introduction to Data Structures
Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
30 May Stacks (5.1) CSE 2011 Winter Stacks2 Abstract Data Types (ADTs) An abstract data type (ADT) is an abstraction of a data structure An.
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.
Programming Life Cycle Problem analysisunderstand the problem Requirements definition specify what program will do High- and low-level designhow it meets.
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
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 Structures Using C++ 2E
1 CSC 427: Data Structures and Algorithm Analysis Fall 2006 See online syllabus (also available through Blackboard): Course goals:
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Ordered Linked Lists using Abstract Data Types (ADT) in Java Presented by: Andrew Aken.
IT108 Objects and Classes Part I George Mason University Revised 4/3/2012.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Protocols Software Engineering II Wirfs Brock et al, Designing Object-Oriented Software, Prentice Hall, Mitchell, R., and McKim, Design by Contract,
Class Design I Class Contracts Readings: 2 nd Ed: Section 9.5, Advanced Topic nd Ed: Section 8.5, Advanced Topic 8.2 Some ideas come from: “Practical.
Data Structure Introduction Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2010.
Chapter 1 Data Abstraction: The Walls CS Data Structures Mehmet H Gunes Modified from authors’ slides.
CSSE501 Object-Oriented Development. Chapter 10: Subclasses and Subtypes  In this chapter we will explore the relationships between the two concepts.
CSC 205 Java Programming II Introduction. Topics Syllabus Course goals and approach Review I Java language fundamentals.
Data Structures and Algorithms in Java AlaaEddin 2012.
1 Introduction 1. Why Data Structures? 2. What AreData Structure? 3. Phases of Software Development 4. Precondition and Postcondition 5. Examples.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
CS 367 Introduction to Data Structures Charles N. Fischer Fall s367.html.
Chapter 2 Principles of Programming and Software Engineering.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
Chapter 1 The Phases of Software Development. Software Development Phases ● Specification of the task ● Design of a solution ● Implementation of solution.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
XuanTung Hoang 1 Something to discuss Feedbacks on Midterm Exam Final exam and term project  Final exam requires solid knowledge/skills in Java  Be more.
Lecture No.05 Data Structures Dr. Sohail Aslam.  Josephus Problem #include "CList.cpp" void main(int argc, char *argv[]) { CList list; int i, N=10, M=3;
Principles of Programming & Software Engineering
About the Presentations
Chapter 1-4 CSc 212 Data Structures, Sec AB CCNY, Spring 2012
Introduction to Data Structures
Slides by Steve Armstrong LeTourneau University Longview, TX
Data Structures and Algorithms for Information Processing
Introduction to Data Structure
Chapter 1-4 CSc 212 Data Structures, Sec FG CCNY, 2009
CMPT 225 Lecture 7 – Stack.
Presentation transcript:

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data Structures and Algorithms for Information Processing Lecture 1: Introduction

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 2 Lecture 1: Introduction Course Web Site

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 3 Lecture 1: Introduction Structure of the Course Lectures / class participation Homeworks (programming) Midterm examination Final examination

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 4 Lecture 1: Introduction Readings Readings from the required text are assigned for each lecture -- read them in advance The book contains self-test exercises in each section Work these exercises (especially if you are new to the material)

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 5 Lecture 1: Introduction Grading Homework(5-6)50% Midterm Exam25% Final Exam25%

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 6 Lecture 1: Introduction Definitions A data structure is an organized collection of data with specific aggregate properties An algorithm is a sequence of program instructions designed to compute a particular result

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 7 Lecture 1: Introduction Five Steps per Datatype Understand it Abstractly Write a Specification Write Applications Select an existing, or Design and Implement our own Analyze the Implementation in terms of performance

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 8 Lecture 1: Introduction Abstract vs. Concrete An abstract data type (ADT) specifies behavior, but not implementation An implementation uses a particular low-level datatype to implement the desired behavior

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. Quick Example A stack is an abstract data type (ADT). We push and pop from the top. Consider three implementations: (1) Every push causes all elements in an array to shift down 1 before the insertion at s[0]. (2) We add at stackTop and then add one to stackTop. (3) A linked list use where the top is always at the list’s front end. Each implementation can be written correctly. Implementation (1) runs in Θ(n). Implementations (2) and (3) run in Θ(1). 9 Lecture 1: Introduction

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 10 Lecture 1: Introduction Step 1: Understanding Grasp the datatype at the level of concepts and pictures e.g., visualize a stack and the operations of pushing / popping Understand simple applications Simulate by hand e.g., use a stack to reverse the order of letters in a word

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 11 Lecture 1: Introduction Step 2: Specification Write a specification for a Java class that could implement the datatype (see javadoc Appendix H) Headings for constructor, public methods, public features Includes precondition / postcondition for each method Independent of implementation!

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 12 Lecture 1: Introduction Step 3: Application Based on the specification, write small applications to illustrate the use of the datatype “Test the specification” prior to implementation Code not yet compiled / run

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 13 Lecture 1: Introduction Step 4: Implementation Select appropriate data structure Implement as private class vars Write rules relating instance variables to abstract specification: the invariant of the ADT Each method knows the invariant is true when it starts Each method upholds the invariant

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 14 Lecture 1: Introduction Step 5: Analysis Correctness Flexibility When possible, compare different implementations of the same ADT Time Analysis –number of operations –big-O notation, e.g.,

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 15 Lecture 1: Introduction Phases of Software Development Specification of the Task Design of a Solution Implementation of the Solution Running Time Analysis Testing and Debugging Maintenance and Evolution Obsolescence

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 16 Lecture 1: Introduction Java Conceived in 1991 at Sun Has Similarities to C++ Is simpler than C++ Object-Oriented Programming (OOP) –information hiding –component re-use –programs (methods) and data are grouped together into classes –we will not be using the collection classes

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 17 Lecture 1: Introduction What You Should Know Already How to use a Java development environment (java, javac, javadoc) How to write, compile, and run short Java programs Java primitive types (number types, char, boolean) and arrays Easy to pick up with prior programming experience

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 18 Lecture 1: Introduction Specifying a Java Method Specification: what a method does not how it does it A form of information hiding called procedural abstraction Method signature public static double celsiusToFahrenheit(double c) Method call double fahrenheit = celsiusToFahrenheit(celsius);

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 19 Lecture 1: Introduction Elements of Specification Short Introduction Parameter Description Returns –Specify the meaning of return value Throws list –error conditions (exceptions) “thrown” by this method Precondition and Postcondition

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 20 Lecture 1: Introduction Preconditions A precondition is a statement giving the condition that should be true when the method is called The method is not guaranteed to perform as it should unless the precondition is true. If violated, ignore (like c) or throw an exception (like Java).

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 21 Lecture 1: Introduction Postconditions A postcondition is a statement describing what will be true when a method call completes If the method is correct and precondition was met, then the method will complete, and the postcondition will be true when it does Use Java assert statement for post- condition checks during debugging. Not during deployment.

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 22 Lecture 1: Introduction Example Specification celsiusToFahrenheit public static double celsiusToFahrenheit(double c) –convert a temperature from Celsius degrees to Fahrenheit degrees –Parameters: c - a temperature in Celsius degrees –Precondition: c>= –Returns: temperature c in Fahrenheit –Throws: IllegalArgument Exception

90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 23 Lecture 1: Introduction More on Pre/Postconditions Slides from Main’s LecturesSlides from Main’s Lectures