Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMPUTER 2430 Object Oriented Programming and Data Structures I

Similar presentations


Presentation on theme: "COMPUTER 2430 Object Oriented Programming and Data Structures I"— Presentation transcript:

1 COMPUTER 2430 Object Oriented Programming and Data Structures I

2 Expected Learning Outcomes
Develop software using elementary data structures. Design, implement, and test programs using classes, inheritance, and polymorphism. Compare and contrast algorithm efficiency at a very basic level. Write module tests, system tests, and develop test specifications. Perform simple object-oriented analysis and design. Work in a small team (two or three people) on the analysis, design, implementation, and testing of a project.

3 Quiz 5 What is the Big O for each of the following:
Deleting from a regular array and keep the order O(N) for (int i = index; i < count – 1; i ++) items[i] = items[i + 1]; count --;

4 Quiz 5 What is the Big O for each of the following: 2. The Queue method remove of circular array implementation O(1) Object obj = items[front]; front = (front + 1) % items.length; return obj;

5 Quiz 5 What is the Big O for each of the following: 3. Finding the sum of a list of numbers O(N) int sum = 0; for (int i = 0; i < count; i ++) sum += items[i];

6 Quiz 5 What is the Big O for each of the following: 3. Finding the sum of a list of Additive instances O(N) Additive sum = new Additive(); for (int i = 0; i < count; i ++) sum = sum.plus(items[i]);

7 Quiz 5 What is the Big O for each of the following: 4. Insertion Sort, average case O(N2) for i = 1 to (size - 1) j = i while j > 0 and a[j] < a[j - 1] Swap a[j], a[j - 1] j --

8 Quiz 5 for I = (N + 4) downto 2 for J = (I - 2) to (N + 5) if --- The total number of times “if” is executed is: ___________________

9 Two Formulas How Many last – first + 1 What is the sum?
(first + last) * (number of items) / 2

10 How Many? last – first + 1 first – last

11 What is the Sum? s = s = *s = (20 + 3) + (19 + 4) (4+19) + (3 +20) = (first + last) * (number of items) s = (first + last) * (first – last + 1) / 2

12 Quiz 5 Pass I First of J Last of J # of Comparisons N+4 N+3 N+2 . 4 3
for I = (N + 4) downto 2 for J = (I - 2) to (N + 5) if --- The total number of times “if” is executed is: ___________________ Pass I First of J Last of J # of Comparisons N+4 N+3 N+2 . 4 3 2 N+2 N+1 N . 2 1 N+5 . 4 5 6 . N+4 N+5 N+6

13 Quiz 5 for I = (N + 4) downto 2 for J = (I - 2) to (N + 5) if --- The total number of times “if” is executed is: ___________________ (N+4) + (N+5) + (N+6) = (4 + (N+6)) * ((N+6) – 4 + 1) / 2 = (N+10) * (N+3) / 2 = (N2 + 13N + 30) / 2

14 Quiz 5: Sorting a. Bubble Sort, 3rd iteration (I = 0, 1, 2) I = 0
7 1 6 5 2 8 3 4 1 7 2 6 5 3 8 4 1 2 7 3 6 5 4 8 1 2 3 7 4 6 5 8

15 Quiz 5: Sorting b. Insertion Sort, 3rd iteration (I = 1, 2, 3) I = 1
7 1 6 5 2 8 3 4 1 7 6 5 2 8 3 4 1 6 7 5 2 8 3 4 1 5 6 7 2 8 3 4

16 Quiz 5: Sorting c. Selection Sort, 3rd iteration (I = 0, 1, 2) I = 0
7 1 6 5 2 8 3 4 1 7 6 5 2 8 3 4 1 2 6 5 7 8 3 4 1 2 3 5 7 8 6 4

17 Binary Search Code Tracing Array of integers Array of Date
Array of Comparable Tracing In array Not in array Format

18 Quiz 6 Wednesday Binary search Hashing Counting

19 Expected Learning Outcomes
Develop software using elementary data structures. Design, implement, and test programs using classes, inheritance, and polymorphism. Compare and contrast algorithm efficiency at a very basic level. Write module tests, system tests, and develop test specifications. Perform simple object-oriented analysis and design. Work in a small team (two or three people) on the analysis, design, implementation, and testing of a project.

20 Prog 6 Must use PFigure as is
It’s different from Pfig of Lab12 Minimum of three sub-classes from Pfigure One drawing and one picture Must make and use a PFigureList Containing instances from at least two sub-classes Polymorphism! Move cannot just left-right, up-down, or bounce

21 SE Tool Time plan Time Log Monday, Dec 3, by 11 pm
Punch in/out when working on Prog 6

22 Prog 6 Group folders

23 Counting Exercise


Download ppt "COMPUTER 2430 Object Oriented Programming and Data Structures I"

Similar presentations


Ads by Google