Download presentation
Presentation is loading. Please wait.
Published byMelissa Hart Modified over 9 years ago
1
CS 210 DATA STRUCTURES AND ALGORITHIMS Fall 2006
2
CS 210 Instructor Mrs. Sarab Almuhaideb. Office: W357 Phone: 4535189 Ext.# 711 Email: smuhaideb@pscw.psc.edu.sasmuhaideb@pscw.psc.edu.sa Office Hours: SUN 12:00 – 1:00, MON 9:00 – 10:50, (or by appointment)
3
CS 210 CS 210 : Data Structures and Algorithms. Credit Hours: 3. Prerequisite: CS 102. Course Home Page: Visit http://www.geocities.com/pscw_cs210 to find course announcements, notes, important dates,assignments, grades and more. http://www.geocities.com/pscw_cs210
4
CS 210 Abstract Data Types ADT: is the study of classes of objects whose logical behavior is defined by a set of values and a set of operations.
5
CS 210 Data Structures The term Data Structures refers to the study of data and how to present objects within a program; that is, the implementation of the structured relationships. We are now interested in the study of the abstract properties of classes of data objects in addition to how the objects might be represented in a program.
6
CS 210 It is well known that data structures have a profound effect on the performance of programs and applications. The main purpose of this course is to introduce the main types of data structures and illustrate their use throughout simple examples and applications. In the process, some guidelines and principles for good programming and application development are given. Course Objectives
7
CS 210 Text Book ADT, Data Structures and Problem Solving with C++, 2 nd Edition. By Larry Nyhoff, Prentice Hall, 2004.
8
CS 210 Evaluation Grading: Major 1 20%. Major 2 20%. Assignments 15%. Quizzes10%. Final35%. No make-up exams.
9
CS 210 Important Dates Major I Exam: Monday November 8, 2006 [8-10]. Major II Exam: Monday December 11, 2006 [8-10]. Quizzes: Quiz 1: Sunday October 1, 2006. Quiz 2: Sunday November 19, 2006. Quiz 3: Sunday December 3, 2006. Final Exam: During the period Jan 20 – 30, 2007.
10
CS 210 Course Policy 1. There will be weekly tutorial problems as well as bi-weekly programming projects. 2. Students are encouraged to solve the tutorial problems before we do them together in class, but are NOT required to submit their solutions. 3. 15% of your grade will be assigned to PROGRAMMING projects. 4. Homework assignments must be done individually( or in pairs as stated in the project ’ s requirements). 5. We do not expect to see two programming projects that look identical. In this case, BOTH projects will be rejected. 6. Please note the due date for your programming project. 7. Late projects will be grade-penalizes or might not be accepted at all. 8. This course adopts the drop-the-lowest policy for assignments and quizzes. 9. All source files must be compiled and fully tested by the student before submission. 10. A program that does not compile is not accepted for any reason. 11. Also, a program with no output is not accepted. 12. A program must be submitted in both electronic copy (the.cpp file) and hard copy. 13. Make sure the floppy is labeled with your name and the assignment number. 14. If a student was absent in any lecture, then she is expected to read the lecture material and is welcomed for any specific question she may has.
11
CS 210 Data Structures Revision: Classes and Abstract Data Types Please read notes page for details.
12
CS 210 Abstraction Captures essential qualities of an object and names the object. Ignores implementation details Is necessary for managing large, complex software projects.
13
CS 210 Data Hiding Hides implementation details from user Prevents user from accessing implementation directly User must interact with object through an interface.
14
CS 210 Hierarchical Design- an Example CIS Carnet Order Lab Order Radiology Order Appointment Documen- tation Lab Gen. LabAPMicroBB SchedulingRadiology CT ScanX-RayMRIUltrasound Patient Registration
15
CS 210 Classes in C++ A class is a means of abstraction in C++ A class is a specification of a group of objects that all have the same essential properties and behaviors. FOR EXAMPLE...
16
CS 210 A class example class Student Properties (data members) name, graduation year, list of courses, number of courses Operations (methods) List Courses List Student Information Add a Course Set Graduation Date
17
CS 210 C++ Data Type class represents an ADT 2 kinds of class members: Data members and function members Class members are private by default Data members are generally private Function members are generally declared public Private class members can be accessed only by the class member functions (and friend functions), not by client code.
18
CS 210 class type declaration The class declaration creates a data type and names the members of the class. It does not allocate memory for any variables of that type! Client code still needs to declare class variables.
19
CS 210 An object is an instance of a class For example: object studentA Name: Andrea Student Graduation Year: 2005 List of Courses: CSCI262, MATH331 Number of courses: 6
20
CS 210 2 separate files generally used for class type // SPECIFICATION FILE ( student.h ) // Specifies the data and function members. class Student { public:... private:... } ; // IMPLEMENTATION FILE (student.cpp ) // Implements the Student member functions....
21
CS 210 Class Student Specification // SPECIFICATION FILE( student.h ) typedef char string9[10]; class Student// declares a class data type {// does not allocate memory public : // 5 public function members void AddCourse(string9 CourseName); void ListCourses(void) const; void ListInfo(void) const; void SetGradDate(int year); Student();// Constructor Function private :// 4 private data members char studentName[30]; string9 courses[6]; int numCourses; int gradDate; } ;
22
CS 210 Implementation file for Student // IMPLEMENTATION FILE ( student.cpp ) // Implements the Student member functions. #include “ student.h ” // also must appear in client code #include... void Student :: SetGradDate (int year ) { gradDate = year; }...
23
CS 210 Class Constructors initialize Data Members // In the file student.cpp Student :: Student () {//Default Constructor numCourses = 0; gradDate = 0; strcpy(studentName, “ John Doe ” ); } // This is invoked in client code at time of object declaration: // Student newStudent( “ Mary Contrary ”, 2010); Student :: Student(char name[ ], int year) {//Constructor with parameters //We will fill this out in class! }
24
CS 210 Use of C++ data type class Facilitates re-use of C++ code for an ADT. Software that uses the class is called a client. Variables of the class type are called objects or instances of the class. Client code uses public member functions to handle its class objects. Private members cannot be directly accessed by client code. It can only be accessed by member functions.
25
CS 210 #include “ student.h ” // includes specification of the class #include int main ( void ) { int newYear; string9 newCourse; Student newStudent;// create new Student object cout << “ Enter graduation year: “ ; cin >> newYear; newStudent.SetGradDate(newYear); // set Graduation date cout << “ Enter course to be added: “ ; cin >> newCourse; newStudent.AddCourse(newCourse); // Add a course newStudent.ListInfo(); // List Student information newStudent.ListCourses(); // List courses } // end of main Client Code Using Student
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.