Presentation is loading. Please wait.

Presentation is loading. Please wait.

D ATA S TRUCTURES 1. I NSTRUCTORS Lectures : Dr. Shimaa Ibrahim Hassan Time: 9:45 Sections.

Similar presentations


Presentation on theme: "D ATA S TRUCTURES 1. I NSTRUCTORS Lectures : Dr. Shimaa Ibrahim Hassan Time: 9:45 Sections."— Presentation transcript:

1 D ATA S TRUCTURES 1

2 I NSTRUCTORS Lectures : Dr. Shimaa Ibrahim Hassan Time: Monday @ 9:45 shaimaa.rizk@feng.bu.edu.eg shimaahassan4779@gmail.com Sections : Eng: Mohamed Hussien Time: Sec.1 Sunday @ 9:00 Sec.2 Tuesday @ 9:00 2

3 T EXTBOOKS Main book: Data Structures and Algorithms in C++, 2 nd edition Goodrich, Michael T.; Tamassia, Roberto; Mount, David M. My reference books: ADTs, Data Structures, and Problem Solving with C++, Prentice Hall, Larry Nyhoff Data Structures And Problem Solving Using C++, Mark Allen Weiss Data Structures and Algorithms in Java, Robert Lafore Extra reference book: The C++ Porgramming language, Addison Wesley, Stroustrup --- creator of C++ 3

4 C OURSE O VERVIEW A fundamental computer engineering course - Essential for programming - Essential for advanced courses A challenging course, which needs - Mathematical and logic thinking - Programming 4

5 C OURSE P REREQUISITE Programming skills Need to know C++ or JAVA PC programming environment Good programming skills Translate pseudo-codes into codes Basic mathematical skills Solving recursive equations, manipulation of symbols, etc. Computer architecture Pointers, storage, memory access, etc. 5

6 A SSIGNMENTS Lab assignments. Programming assignments Due by time specified Run on PC Detailed analysis report Late policy : Must be submitted by 12:00 am of the due date One day late costs 10% off Two days late costs 20% off Three days late costs 40 % off Four days late is not accepted 6

7 C OURSE O BJECTIVES Study an effective programming method for software projects of realistic size. Difficulties arise not in finding a solution, but rather in deciding on the best algorithm to use The greatest room for variability in algorithm design is in the way in which the data are stored: How they are arranged in relation to each other Which data are kept in memory Which are calculated when needed Which are kept in files, and how the files are arranged Present several ideas for data organization and several algorithms for important data processing tasks such as sorting and searching. 7

8 8 C OURSE O UTLINE Program development process Data modeling and ADT OOP and classes Arrays, Records and Sets Linked Lists Recursion Stacks and Queues Trees Sorting and Searching Graphs

9 G RADING SYSTEM Final exam..................................... 75 degrees Mid-term...................................... 20 degrees Lab and practical exam.................. 20 degrees Project........................................... 10 degrees

10 P ROGRAM D EVELOPMENT P ROCESS 10

11 S OFTWARE D EVELOPMENT C YCLE Steps for writing small programs: Get the assignment Devise an algorithm for solving the problem Express the algorithm as a computer program in a specific language Type the program into the computer Compute the program; revise it to correct errors (compiler errors) Run the program with sample data; check for the correct answers; correct the discovered errors (run time errors) Run the program with actual data and get the results 11

12 D EVELOPING A S OFTWARE S YSTEM User requirement Between software team and user System analysis Technical statement that shows the major components of the system, data flow, required outputs, errors to check for, procedures to follow, constraints … etc. System design Choosing data types and algorithms for each major component of the system specified in the pervious stage. Breaking the system into small functions May include writing some pseudo codes. 12

13 D EVELOPING A S OFTWARE S YSTEM ( CONT.) Implementation The designed system is translated into code in HLL Correcting the compiler’s error Testing Running the system with data for which the correct results are known and check for the output results and correcting the errors if found Running the system with some data containing errors that requirements ask to be checked Running the system with real data supplied by the client and fix errors if found. 13

14 D EVELOPING A S OFTWARE S YSTEM ( CONT.) Installation The system and required software are placed on the clients’ machines. The personnel who will operate the system are trained Maintenance This term includes everything that is done to the system after the user has accepted the initial version, such as: Correcting errors not detected earlier Adding new features Modification required related to H/W updates 14

15 C HARACTERISTICS OF A G OOD P ROGRAM Correctness Reliability Correct output for correct input Meaningful error messages for incorrect input Portability Easily moved from one machine to another with minimum modifications. Using popular programming language and avoiding non-standard language features Maintainability Easily to be maintained by achieving readability feature 15

16 C HARACTERISTICS OF A G OOD P ROGRAM ( CONT.) Readability Making the program easy to read by good program design; using good comments and meaningful variable names A readable program is: More likely to be correct Faster and cheaper to test Faster and cheaper to maintain Faster and cheaper to modify Use of resources A good program is fast and uses minimum of storage 16

17 P ROGRAMING S TYLE Choose meaningful names Declare all constants in the declaration section Minimize the number of global variables Declare the variable wisely in the program to minimize used resources Use spaces, blank lines and end lines to promote clarity Use comments intelligently: Detailed comment at the beginning of the program and each function to describe their general purpose Inline comments as required organize your program into functions, each with coherent purpose The main program should be mainly function calls 17

18 D ATA M ODELING & ADT S 18

19 D ATA M ODELING Real-world applications need to be reduced to a small number of existing problems (top-down design) Real-world data need to be described in an abstract way in terms of fundamental structures The collection of data in some organization is called a “Data Structure” The sequences of operations to be done on the data are called “Algorithms” An Algorithm is a procedure to do a certain task An Algorithm is supposed to solve a general, well-specified problem 19

20 20 D ATA M ODELING A real-world application is basically Data Structures + Algorithms Data and the Operations on that data are parts of an object that cannot be separated. These two faces of an object are linked. Neither can be carried out independently of the other.

21 21 T HE D ATA C ONE Real-world Data ADTs Data Structures Fundamental Data Types

22 22 A BSTRACT D ATA T YPES (ADT S ) The most important attribute of data is its type. Type implies certain operation. It also prohibits other operations. For example, + - * / are allowed for types int and double, but the modulus (%) is allowed for int and prohibited for double. When a certain data organization + its operations are not available in the language, we build it as a new data type. To be useful to many applications, we build it as an Abstract Data Type.

23 23 A BSTRACT D ATA T YPES (ADT S ) An ADT represents the logical or conceptual level of the data. It consists of: 1. A collection of data items in some Data Structure 2. Operations ( algorithms ) on the data items For example, a Stack supports retrieval in LIFO (Last In First Out) order. Basic operations are push and pop. It can be implemented using arrays (static or dynamic) or linked lists

24 A BSTRACT D ATA T YPES (ADT S ) The Data Structure used in implementing an ADT is usually dependent on the language. In contrast, the definition of the ADT is separated from its implementation (Data Abstraction) e.g. ADT Stack can be implemented using a static array, a dynamic array or pointers. An ADT can be used in more than one application. 24

25 25 U SING ADT’ S ADT Application Standard Types/Libraries User Built ADT’s

26 A C LASSIFICATION OF A BSTRACT S TRUCTURES According to the relationship between members Abstract Structures SetsLinearTreesGraphs 26

27 S ETS Order of elements does not matter. Only that they are members of the same set ({1,3,4} is identical to {1,4,3}). Can be implemented using arrays or linked lists. Used in problems seeking: groups collection 27

28 L INEAR S TRUCTURES Sequential, one-to-one relationship. Examples: Tables, Stacks, Queues, Strings Can be implemented using arrays and linked lists (structs and pointers). Used in problems dealing with: Searching, Sorting, stacking, waiting lines. Text processing, character sequences, patterns Arrangements, ordering, tours, sequences. 28

29 T REES Non-Linear, hierarchical one-to-many. Examples: Binary Trees, Binary Search Trees (BST) Can be implemented using arrays, structs and pointers Used in problems dealing with: Searching Hierarchy Ancestor/descendant relationship Classification 29

30 G RAPHS Non-Linear, many-to-many. Can be implemented using arrays or linked lists Used to model a variety of problems dealing with: Networks Circuits Web Relationship Paths 30

31 31


Download ppt "D ATA S TRUCTURES 1. I NSTRUCTORS Lectures : Dr. Shimaa Ibrahim Hassan Time: 9:45 Sections."

Similar presentations


Ads by Google