hello quizlet
Home
Subjects
Expert solutions
Create
Study sets, textbooks, questions
Log in
Sign up
Upgrade to remove ads
Only $35.99/year
CS 113 Topic 3
Flashcards
Learn
Test
Match
Flashcards
Learn
Test
Match
Terms in this set (10)
What dictates n in Big O?
Single loop = n
Nested loop = n^2
UML diagram notes
How do you show inheritance? Composition?
class name
________________
instance variables
______________________
methods
________________________
Show inheritance with an arrow pointing to main class
Show composition with a shaded diamond pointing to main class
composition: "has a"
inheritance: "is a"
UML Diagrams (10 points)a. Create a UML diagram with 6 classes (make up the classes). The classes should be related to a home stereo. Show both composition and inheritance. Each class should have at least two attributes and two methods.
2. Sequence Diagram (5 points)a. Create a basic sequence diagram of preparing a meal (getting ingredients, cooking etc.)
What does Big(O) represent?
theoretical run time; parameter represents run time
Given O(value in terms of n), how can you determine which function runs the fastest and which the slowest?
Higher derivative = larger run time = slower
Knowing higher number in parameter equals slower
Knowing the theory table: top of image is fastest, bottom is slowest
List parameters in Big O from fastest to slowest, in general
How can derivatives be used to determine which function runs the fastest and which the slowest?
Higher derivative = larger run time = slower
3. Big-O notation (10 points)a. Rank the following in order of increasing run times, if they are same list them together.i. O(N)ii. O()∞iii. O(NM)iv. O()𝑁v. O(5)vi. O(N2)vii. O(log N)viii. O(N log N)ix. O(0)x. O(N4)xi. O(2/N)xii. O(2N)xiii. O(N1.5)
What is the complexity of the following pieces of code? (Answer using Big O notation) (10 points)
sum = 0;for (i = 0; i < n; i++) { sum++;}
sum = 0;for (i = 0; i < n; i++) {for (j = 0; j < n; j++) { sum++; }}
sum = 0;for (i = 0; i < n; i++) {for (j = 0; j < i; j++) { sum++; }}
sum = 0;for (i = 0; i < n
n; i++) {for (j = 0; j < n
n; j++) { sum++; }}
Sets found in the same folder
Stack, Queue, and Deque
24 terms
Java Review
24 terms
HW 3
2 terms
Other sets by this creator
gre vocab
3 terms
GitBash commands
32 terms
Miscellaneous
2 terms
Attributes
8 terms
Other Quizlet sets
SURGERY-STATE EXAM לא ידעתי
299 terms
momentum test
41 terms
Regular Spanish 2A -Guia de Estudio
79 terms
AHT II Review
13 terms