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 Containers Bag Set Stack Queue Sorted List . . . Array Linked List

3 Reference and Object Class variable is a pointer (reference) and keeps the address of an object Quiz is coming? Program due! Class Variable 3 3 3

4 public class Node { private Student studentInfo; private Node next; // Note the type! public Node (Student x, Node p ) studentInfo = x; next = p; } public Node (Student x ) next = null; . . . Quiz is coming? Program due! 4 4 4

5 Linked Lists Linked lists can have their data "scattered" all over memory list Quiz is coming? Program due! 5 5 5

6 CS 2630 – OOPS II Linked List Tree Recursion . . .

7 Quiz 6 h1(key) = key % 13 h2(key) = 1 + key % 11 Key 25 38 12 47 34 21
61 35 22 h1(key) 8 9 h2(key) 4 6 2 11 7 3 1

8 Linear Probe h1(key) = key % 13 ( h2(key) = 1 + key % 11 ) Key 25 38
12 47 34 21 61 35 22 h1(key) 8 9 h2(key) 4 6 2 11 7 3 1 1 2 3 4 5 6 7 8 9 10 11 12 38 35 22 47 34 21 61 25

9 Double Hashing h1(key) = key % 13 h2(key) = 1 + key % 11 Key 25 38 12
47 34 21 61 35 22 h1(key) 8 9 h2(key) 4 6 2 11 7 3 1 1 2 3 4 5 6 7 8 9 10 11 12 35 38 21 47 61 34 22 25

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

11 Quiz 6 Pass I First of J Last of J # of calls 3 4 5 . N+2 N+3 N+4 N+5
for (int I = 3; I < N + 5; I ++) for (int J = N + 5; J >= I – 2; J --) Quiz6(); The total number of times Quiz6 is called: ___________________ Pass I First of J Last of J # of calls 3 4 5 . N+2 N+3 N+4 N+5 . 1 2 3 . N N+1 N+2 N+5 N+4 N+3 . 6 5 4

12 Quiz 6 The total number of times Quiz6 is called: (N+5) + (N+4) + (N+3) = (N+3) + (N+4) + (N+5) = (4 + (N+5)) * ((N+5) – 4 + 1) / 2 = (N+9) * (N+2) / 2 = (N2 + 11N + 18) / 2

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

14 Quiz 6 Call ComparaTo multiple times Interface Comparable No Good!
CompareTo returns an integer > 0 < 0

15 Test 3 Wednesday, December 12 Quiz 5 Quiz 6 LSP

16 Prog 6 Total Points: 35 Plan in SE Tool Punch In/Out in SE Tool

17 Course Outcomes Survey
About the course Not the instructor


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

Similar presentations


Ads by Google