Data Structures Using C++ 2E

Slides:



Advertisements
Similar presentations
Data Structures Using C++ 2E
Advertisements

Lecture 11: Algorithms and Time Complexity I Discrete Mathematical Structures: Theory and Applications.
Data Structures Using Java1 Chapter 1 Software Engineering Principles and Java Classes.
Data Structures Using C++ 2E The Big-O Notation. Data Structures Using C++ 2E2 Algorithm Analysis: The Big-O Notation Analyze algorithm after design Example.
CS 3610/5610N data structures Lecture: complexity analysis Data Structures Using C++ 2E1.
© Janice Regan Problem-Solving Process 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
1 Data Structures A program solves a problem. A program solves a problem. A solution consists of: A solution consists of:  a way to organize the data.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Java Programming, 3e Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Chapter 1 Principles of Programming and Software Engineering.
Chapter 1 Software Engineering. Homework ► Read Section 2.2 (pages 79-98) ► Answer questions: ► 7, 8, 11, 12, & 13 on page 134. ► Answer on paper, hand.
Chapter 1: An Overview of Computers and Programming Languages
Software Engineering Principles and C++ Classes
Programming Fundamentals (750113) Ch1. Problem Solving
Elementary Data Structures and Algorithms
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
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.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Data Structures and Programming.  John Edgar2.
CHAPTER 1 AN OVERVIEW OF COMPUTERS AND PROGRAMMING LANGUAGES.
Chapter 9 High-Level Programming Languages: C++. Chapter Goals Describe the expectations of high level languages Distinguish between functional design.
CS 1031 Introduction (Outline) The Software Development Process Performance Analysis: the Big Oh. Abstract Data Types Introduction to Data Structures.
Introduction To System Analysis and design
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Comp 245 Data Structures Software Engineering. What is Software Engineering? Most students obtain the problem and immediately start coding the solution.
CIT241 Prerequisite Knowledge ◦ Variables ◦ Operators ◦ C++ Syntax ◦ Program Structure ◦ Classes  Basic Structure of a class  Concept of Data Hiding.
Week 2 CS 361: Advanced Data Structures and Algorithms
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Department of Computer Science 1 COSC 2320 Section Room 104 AH 5:30 – 7:00 PM TTh Professor Olin Johnson Office 596 PGH
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Data Structures Using C++1 Chapter 1 -Software Engineering Principles -ADT and Classes.
Program Efficiency & Complexity Analysis. Algorithm Review An algorithm is a definite procedure for solving a problem in finite number of steps Algorithm.
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
Software Engineering Review CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and Computer Science.
The basics of the programming process The development of programming languages to improve software development Programming languages that the average user.
Data Structures Using C++ 2E Chapter 1 Software Engineering Principles and C++ Classes.
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.
1-1 Software Development Objectives: Discuss the goals of software development Identify various aspects of software quality Examine two development life.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Chapter 10: Classes and Data Abstraction. Objectives In this chapter, you will: Learn about classes Learn about private, protected, and public members.
Software Engineering and Object-Oriented Design Topics: Solutions Modules Key Programming Issues Development Methods Object-Oriented Principles.
1 Chapter 1 Programming Languages Evolution of Programming Languages To run a Java program: Java instructions need to be translated into an intermediate.
Data Structure Introduction Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2010.
Chapter 1 Software Engineering Principles. Problem analysis Requirements elicitation Software specification High- and low-level design Implementation.
Data Structures Using C++ 2E
Algorithm Analysis (Time complexity). Software development cycle -Four phases: 1.Analysis 2.Design Algorithm Design an algorithm to solve the problem.
Chapter 10: Classes and Data Abstraction. Classes Object-oriented design (OOD): a problem solving methodology Objects: components of a solution Class:
Chapter 2 Principles of Programming and Software Engineering.
C++ for Engineers and Scientists, Second Edition 1 Problem Solution and Software Development Software development procedure: method for solving problems.
Data Structures Using Java1 Chapter 1 Software Engineering Principles and Java Classes.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
1 CS 132 Spring 2008 Chapter 1 Software Engineering Principles and C++ Classes.
Principles of Programming & Software Engineering
Algorithms and Problem Solving
Asymptotic Notations Algorithms perform f(n) basic operations to accomplish task Identify that function Identify size of problem (n) Count number of operations.
Principles of Programming and Software Engineering
Data Structures Using The Big-O Notation 1.
About the Presentations
Asymptotic Notations Algorithms perform f(n) basic operations to accomplish task Identify that function Identify size of problem (n) Count number of operations.
Programming Fundamentals (750113) Ch1. Problem Solving
Algorithms and Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
Asymptotic Notations Algorithms perform f(n) basic operations to accomplish task Identify that function Identify size of problem (n) Count number of operations.
Programming Fundamentals (750113) Ch1. Problem Solving
Presentation transcript:

Data Structures Using C++ 2E Chapter 1 Software Engineering Principles and C++ Classes

Objectives Learn about software engineering principles Discover what an algorithm is and explore problem-solving techniques Become aware of structured design and object-oriented design programming methodologies Learn about classes Become aware of private, protected, and public members of a class Data Structures Using C++ 2E

Objectives (cont’d.) Explore how classes are implemented Become aware of Unified Modeling Language (UML) notation Examine constructors and destructors Become aware of an abstract data type (ADT) Explore how classes are used to implement ADTs Data Structures Using C++ 2E

Software Life Cycle Program life cycle Program retirement Many phases between program conception and retirement Three fundamental stages Development, use, and maintenance Program retirement Program too expensive to maintain No new version released Software development phase First and most important software life cycle phase Data Structures Using C++ 2E

Software Development Phase Four phases Analysis Design Implementation Testing and debugging First and most important step Analysis requirements Thoroughly understand the problem Understand the problem requirements Divide problem into subproblems (if complex) Data Structures Using C++ 2E

Software Development Phase (cont’d.) Design Design an algorithm to solve the problem or subproblem Algorithm Step-by-step problem-solving process Solution obtained in finite amount of time Structured design Dividing problem into smaller subproblems Also known as: top-down design, stepwise refinement, and modular programming Data Structures Using C++ 2E

Software Development Phase (cont’d.) Design (cont’d.) Object-oriented design (OOD) Identifies components called objects Determines how objects interact with one another Object specifications: relevant data; possible operations performed on that data Object-oriented programming (OOP) language Programming language implementing OOD Object-oriented design principles Encapsulation, inheritance, and polymorphism Data Structures Using C++ 2E

Software Development Phase (cont’d.) Implementation Write and compile programming code Implement classes and functions discovered in the design phase Final program consists of several functions Each accomplishes a specific goal Precondition Statement specifying condition(s) Must be true before function called Postcondition Statement specifying true items after function call completed Data Structures Using C++ 2E

Software Development Phase (cont’d.) Testing and debugging Testing Testing program correctness Verifying program works properly Increase program reliability Discover and fix errors before releasing to user Test case Set of inputs, user actions, other initial conditions, and the expected output Document properly Black-box testing and white-box testing Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation Analyze algorithm after design Example 50 packages delivered to 50 different houses 50 houses one mile apart, in the same area FIGURE 1-1 Gift shop and each dot representing a house Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) Example (cont’d.) Driver picks up all 50 packages Drives one mile to first house, delivers first package Drives another mile, delivers second package Drives another mile, delivers third package, and so on Distance driven to deliver packages 1+1+1+… +1 = 50 miles Total distance traveled: 50 + 50 = 100 miles FIGURE 1-2 Package delivering scheme Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) Example (cont’d.) Similar route to deliver another set of 50 packages Driver picks up first package, drives one mile to the first house, delivers package, returns to the shop Driver picks up second package, drives two miles, delivers second package, returns to the shop Total distance traveled 2 * (1+2+3+…+50) = 2550 miles FIGURE 1-3 Another package delivery scheme Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) Example (cont’d.) n packages to deliver to n houses, each one mile apart First scheme: total distance traveled 1+1+1+… +n = 2n miles Function of n Second scheme: total distance traveled 2 * (1+2+3+…+n) = 2*(n(n+1) / 2) = n2+n Function of n2 Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) Analyzing an algorithm Count number of operations performed Not affected by computer speed TABLE 1-1 Various values of n, 2n, n2, and n2 + n Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) Example 1-1 Illustrates fixed number of executed operations Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) Example 1-2 Illustrates dominant operations Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) Search algorithm n: represents list size f(n): count function Number of comparisons in search algorithm c: units of computer time to execute one operation cf(n): computer time to execute f(n) operations Constant c depends computer speed (varies) f(n): number of basic operations (constant) Determine algorithm efficiency Knowing how function f(n) grows as problem size grows Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) TABLE 1-2 Growth rates of various functions Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) TABLE 1-3 Time for f(n) instructions on a computer that executes 1 billion instructions per second Figure 1-4 Growth rate of functions in Table 1-3 Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) Notation useful in describing algorithm behavior Shows how a function f(n) grows as n increases without bound Asymptotic Study of the function f as n becomes larger and larger without bound Examples of functions g(n)=n2 (no linear term) f(n)=n2 + 4n + 20 Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) As n becomes larger and larger Term 4n + 20 in f(n) becomes insignificant Term n2 becomes dominant term TABLE 1-4 Growth rate of n2 and n2 + 4n + 20n Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) If function complexity can be described by complexity of a quadratic function without the linear term We say the function is of O(n2) or Big-O of n2 Let f and g be real-valued functions Assume f and g nonnegative For all real numbers n, f(n) >= 0 and g(n) >= 0 f(n) is Big-O of g(n): written f(n) = O(g(n)) If there exists positive constants c and n0 such that f(n) <= cg(n) for all n >= n0 Data Structures Using C++ 2E

Algorithm Analysis: The Big-O Notation (cont’d.) TABLE 1-5 Some Big-O functions that appear in algorithm analysis Data Structures Using C++ 2E

Summary Program life cycle software development phases Analysis, design, implementation, testing, and debugging Algorithm: step-by-step problem-solving process Solution obtained in finite amount of time Object-oriented design principles Encapsulation, inheritance, and polymorphism Constructors guarantee class instance variables initialized UML diagrams: graphical notation describing class and its members Data Structures Using C++ 2E

Summary (cont’d.) Data abstraction Separating logical data properties from implementation details Class: collection of fixed number of components Components called members Destructors: functions without a type Structs: special type of classes Abstract data type (ADT) Data type separating logical properties from implementation details Data Structures Using C++ 2E