Download CIS 265/506 Midterm Review

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Java syntax wikipedia , lookup

Subroutine wikipedia , lookup

Falcon (programming language) wikipedia , lookup

Radix sort wikipedia , lookup

Control flow wikipedia , lookup

Sorting algorithm wikipedia , lookup

C syntax wikipedia , lookup

Buffer overflow protection wikipedia , lookup

Array data structure wikipedia , lookup

Corecursion wikipedia , lookup

C++ wikipedia , lookup

Object-oriented programming wikipedia , lookup

Class (computer programming) wikipedia , lookup

Name mangling wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

C Sharp syntax wikipedia , lookup

Transcript
CIS 265/506
Midterm Review
Fall, 2013
Study all class notes, handouts, quizzes and programming assignments. Especially study the following
topics:
1. CIS 260/500 Review – study the handout covered in class.
2. Programs = Alogorithms + Data Structures.
3. Java review : members of a class – fields, constructors, methods; compiling and executing a Java program using
javac and java; programming conventions for naming classes, fields, methods; primitive types, reference types,
arithmetic operators, logical operators, order of precedence; looping constructs: for loop, for-each loop, while loop;
selection constructs: if, if-else, switch statements; using Scanner class for input, PrintWriter class for output; reading
an entire input file using a Scanner and a while loop; study the PieceOfFabric handout. Using command line
arguments.
4. String class: in java.lang package; creating a String using new operator and String constructor, and “shortcut” way
for creating a String without using new operator.
5. Comparing Strings: == vs. equals method; other String methods: charAt, compareTo, indexOf, concat, toUpper,
toLower, substring (2 versions of this method).
6. Creating objects using new operator and constructor.
7. User-defined methods – methods have return type and parameters; primitive types are passed by value, reference
types are passed by value in Java.
8. Arrays – every array has a length attribute (field); using for loops with arrays; creating and initializing arrays (e.g.
int[] x = {5, 3, 8, 9}); using for-each loop with an array; arrays of objects – important – creating an array of objects –
pgs. 66- 69 example; creating an array of objects by reading input data from a file – refer to Bicycle class and BikeApp
handout on the CIS 260/500 Review sheet, and refer to PieceOfFabric example.
9. Operations on arrays – insert, find, delete – the duplicate issue – pg. 37; table 2.1 pg. 39; find, insert, delete code
pgs. 49-51; writing find an delete methods without using break statements (see class notes for this).
10. Linear search vs. binary search on an ordered array; ordered array class definition on pg. 59 – the find method uses
a binary search; advantages of ordered arrays – pg. 61-62.
11. Logarithms – pg. 62; big O notation pg. 70-71; running times in big O notation – Table 2.5 pg. 71. Big O
hierarchy and the “time hog principle” (see class notes).
12. Problems with arrays – fixed size – read pgs. 72 and 73.
13. Array of objects e.g. pg. 66-69.
14. Why not use arrays for everything? – read pgs. 72-73.
15. “Simple Sorting” – chapter 3 bubble sort, selection sort, insertion sort – all have average running times of O(n2);
know these algorithms. Be able to trace through each pass (see quiz question on this).
16. Code for bubble sort: pg. 87 (typo. in for loop should be: for (out = nElems -1; out >=1; out--)
17. Code for selection sort – bottom of pg. 93, top of pg. 94; the swap method code, pg. 94.
)
CIS 265/506 Midterm Review (continued)
2.
18. Code for insertion sort – pg. 99-100
19. Loop invariants – e.g. pg. 88 (for bubble sort)
20. Analyzing sorts for obtaining big O running times (e.g. pg. 88 for bubble sort)
21. Sorting objects: e.g. pgs. 104-107
22. Stacks and Queues, chapter 4
23. Implementing a Stack using an array -- see pg. 120-122; push, pop, peek, isEmpty, isFull methods – know code
pgs. 120-121; note how stack is initialized – see constructor pg. 120; stack overflow and stack underflow
24. Stack applications: delimiter matching (pgs. 127-131), subroutine linkage (see class notes – using a stack for
saving return addresses – when subroutine is called, return address is pushed on stack, when return statement is
executed, return address is popped off of stack); converting infix to postfix – translation rules on page 159; evaluating
a postfix expression – see table 4.14 pg. 168; using a stack to check if a word is a palindrome (see class notes);
converting binary to decimal and decimal to binary (see assignment 5)
25. Implementing a Queue using an array – see pgs. 138-140; know code for insert, remove, peekFront, isEmpty,
isFull, size; note how queue is initialized – see constructor pg. 138; queue overflow and queue underflow
26. Variation on a queue: deque – a double-ended queue (pg. 143); priority queues – see pgs. 147-148
27. Linked lists, chapter 5: Link class (we used the name Node for this class) pg. 185; another example – pg. 190-191;
class LinkList pg. 186; another example pg. 190-191
28. Important methods in LinkList class: know code pg. 191-192 for methods isEmpty, insertFirst, deleteFirst,
displayList
29. Finding a node, deleting and inserting nodes into a linked list – pgs. 193-195; also know code for find
method discussed in class (using: while (current != null && current.data != key) ) – using this
while condition is “cleaner” and uses only a single return statement; note use of previous, and current
in the delete code
30. Double-ended lists (has first and last reference); know methods insertFirst, insertLast, deleteFirst
on pg. 199
31. Stack implemented by a linked list: pg. 204-205
32. Queue implemented by a linked list: pg. 207-209
33. Sorted linked list: know code pg. 214 for insert; efficiency in big-Oh notation: pg. 218; know how insertion sort is
done using a sorted linked list.
34. Doubly linked lists – each Link has a next and previous reference – pg. 226-230; study the insertFirst,
insertLast, deleteFirst, deleteLast, insertAfter, deleteKey methods
35. Circularly linked lists and multiply linked lists – refer to class notes
36. Iterators
37. Recursion (introduction)