CS: Pod of Delight Week 7: CS314H Midterm First of all First of - - PowerPoint PPT Presentation

cs pod of delight
SMART_READER_LITE
LIVE PREVIEW

CS: Pod of Delight Week 7: CS314H Midterm First of all First of - - PowerPoint PPT Presentation

CS: Pod of Delight Week 7: CS314H Midterm First of all First of all Tetris! How is project going? Pair programming? Second of all Discrete Midterm! How did it go? First Turing midterm Third of all Did you have a good


slide-1
SLIDE 1

CS: Pod of Delight

Week 7: CS314H Midterm

slide-2
SLIDE 2

First of all

slide-3
SLIDE 3

First of all

  • Tetris!
  • How is project going?
  • Pair programming?
slide-4
SLIDE 4

Second of all

  • Discrete Midterm!
  • How did it go?
  • First Turing midterm
slide-5
SLIDE 5

Third of all

  • Did you have a good weekend?
  • Don’t forget to have fun!
slide-6
SLIDE 6

Fourth of all

  • Data Structures Midterm
slide-7
SLIDE 7

CS314H Midterm

  • What to expect?
  • What are you learning in class?
slide-8
SLIDE 8

Things to know

  • Be familiar with all the projects you’ve done
  • If you didn’t do it, at least read the karma
  • Understand algorithms/concepts that you used
slide-9
SLIDE 9

Things to know

  • Data structures
  • HashMaps, HashTrees, Linked Lists, Binary

trees, heaps, tries

slide-10
SLIDE 10

Things to be familiar with

  • Object oriented programming
  • Encapsulation, inheritance, polymorphism
  • Interfaces, abstract classes, final, private, public
  • Overloading
  • Dynamic binding
  • Autoboxing
  • Covariance
  • Generics
  • Parametrized generics
slide-11
SLIDE 11

Dynamic Binding Example

  • class x; class y extends x; class z extends y;
  • class Pub { foo(x); }
  • class Book extends Pub { foo(x); foo(y); foo(z); }
  • Pub p = new Book();
  • What method gets called with: p.foo(z)?
  • Book.foo(x)
slide-12
SLIDE 12

Interfaces, Abstract Classes

  • What is difference?
  • Interfaces are only contracts!
  • But can have default implementation (Java 8+)
  • Abstract classes can implement methods with state
  • Multiple inheritance
  • Which can be instantiated?
  • Neither!
slide-13
SLIDE 13

Covariance Example

  • class Shape; class Circle extends Shape; class

Square extends Shape;

  • Shape[] arr = new Circle[5];
  • Is this legal: arr[0] = new Square(); ?
  • No! runtime error! arrays are covariant
slide-14
SLIDE 14

Things to be familiar with

  • Search algorithms
  • Binary search, linear searching
  • Sorting algorithms
  • Quicksort, mergesort, bubble sort, insertion sort,

selection sort, integer sort, radix sort

  • Their complexities
slide-15
SLIDE 15

Data Structures and Complexities

Data Structure Search Insert/Delete Array n 1 Linked List n 1/n Hash table/map 1 1 Tree logn logn BinHeap 1 (max/min) or logn logn

slide-16
SLIDE 16

Algorithms and Complexities

Algorithm Best Average Worst Quicksort nlogn nlogn n^2 Mergesort nlogn nlogn nlogn Bubble sort n n^2 n^2 Insertion n n^2 n^2 Selection n^2 n^2 n^2

slide-17
SLIDE 17

Things to know

  • Complexity Analysis
  • Big-Oh - upper bound (grows no faster)
  • Big-Omega - lower bound (grows no slower)
  • Big-Theta - exact bound
  • Little-Oh - stricter upper bound (strictly slower)
slide-18
SLIDE 18

Most important!

  • Be relaxed!
  • Do not overstudy, no point in memorizing

everything, stressing/eating out

  • Get lots of sleep the night before
  • Think of it as a fun puzzle session :)
  • Ask a clarification question if something seems

wrong

slide-19
SLIDE 19

Good luck!