Transcript .ppt

Announcements
•
•
•
•
Check your grades on the door of 5141 Upson
More review tomorrow
Review session Sunday night w/Alan
FINAL EXAM: Tuesday August 10, 8 AM (IN THE
MORNING) Olin 155
• Review sheet has been handed out -- you should
know all the material on this sheet, but do not
assume it includes everything you need to know
• Bring me pictures and a short note if you want a
letter of reference. . .
CS 100
Lecture 23
1
Review. . .
• Know the prelim!
• Know the material on the quizzes!
• Go over your assignments and make sure
you understand where you made mistakes
and how you’d fix them.
CS 100
Lecture 23
2
Control structures
•
•
•
•
if
if/else
while
for
CS 100
Lecture 23
3
Classes and subclasses
•
•
•
•
•
What’s a class?
What’s an object?
What’s a class hierarchy?
What’s inheritance? How does it work?
What are constructors? What’s super?
CS 100
Lecture 23
4
More on classes
• public vs. private fields and methods
• What does it mean to override a method?
– Give an example
• What does it mean to overload a method?
– Give an example
CS 100
Lecture 23
5
Scope of variables?
• What’s scope?
• What’s the
scope of a
parameter?
• A local
variable?
• A field of a
class?
CS 100
public class Coordinate {
public int x;
public int y;
public Coordinate(int xx, int yy) {
x = xx;
y = yy;
}
public void swapFields() {
int tmp;
tmp = x;
x = y;
y = tmp;
}
Lecture 23
6
Static
• Static variables in a class
• Static methods -- give an example?
• Why use static variables and methods?
CS 100
Lecture 23
7
Methods
•
•
•
•
•
What are the infamous FOUR STEPS?
What’s a frame? How/when is a frame created?
Know how to draw and label a frame correctly
Call-by-value
Parameter passing (primitive types vs. object
references)
• return
CS 100
Lecture 23
8
Operators and statements
•
•
•
•
The ternary operator in Java
++, --, -=, +=
break;
continue
CS 100
Lecture 23
9
Arrays
•
•
•
•
How to declare an array?
How to initialize an array?
Arrays as parameters in C?
Arrays of objects
CS 100
Lecture 23
10
Search algorithms
• Binary vs. linear search
• Write linear search
• Sketch binary search
CS 100
Lecture 23
11
Sorting algorithms
• Describe each, including bubble sort
• Be able to read and debug search algorithms
• Understand the partition algorithm
CS 100
Lecture 23
12
Efficiency
• How is the efficiency of an algorithm
measured?
• What’s linear -- O(n)?
• What’s logarithmic -- O(log n)?
• What’s the n refer to here?
CS 100
Lecture 23
13
Matlab
• What’s the fundamental data structure in
Matlab?
• Linspace? What’s that?
• Know the colon/semicolon notation
• How do you access the row of a matrix?
• How do you access the column of a matrix?
CS 100
Lecture 23
14
More Matlab
• What’s the transpose of a matrix?
• What does f(x) do in Matlab if x is an
array?
• What do the control structures look like in
Matlab?
• Be able to read Matlab code and generate
some yourself.
CS 100
Lecture 23
15
Recursion
• What’s recursion?
• Give examples of recursive algorithms
• Be able to write a small recursive algorithm
(something like factorial, for example)
CS 100
Lecture 23
16
Advanced Topics
• What are threads?
• What’s the abstract modifier all about?
• What are interfaces? When would you use
one?
• What are exceptions?
CS 100
Lecture 23
17
C
• What are the advantages and disadvantages
of C vs. Java?
• What are pointers?
• Be able to read C code (small examples as
presented in class) and understand it
CS 100
Lecture 23
18
Final thoughts
• In 1995, One of the inventors of Java, Bill
Joy, said: “Java is just a small, simple, safe, objectoriented, interpreted or dynamically optimized, byte-coded,
architecture-neutral, garbage-collected, multithreaded
programming language with a strongly typed exceptionhandling mechanism for writing distributed, dynamically
extensible programs.”
• Remember: You never finish a program, you
just stop working on it. . .
• Fun book: Snow Crash by Neal Stephenson
CS 100
Lecture 23
19