acct name bob bal 42 flight seatsavail aisle 6
play

acct == {name: Bob, bal: 42} flight.seatsAvail(AISLE) >= 6 - PowerPoint PPT Presentation

acct == {name: Bob, bal: 42} flight.seatsAvail(AISLE) >= 6 memoized memoized boolean seatsAvail(SeatType t, int n) { return seatsAvail(t) >= n; } for (Flight f : flights) if (f.seatsAvail(AISLE, 3))


  1. acct == {name: “Bob”, bal: 42} flight.seatsAvail(AISLE) >= 6

  2. • • •

  3. • • •

  4. memoized memoized boolean seatsAvail(SeatType t, int n) { return seatsAvail(t) >= n; } for (Flight f : flights) if (f.seatsAvail(AISLE, 3)) displayFlights.add(f);

  5. f.seatsAvail(AISLE, 3) == true true f.seatsAvail(AISLE, 3) == ? for (Flight f : flights) f.seatsAvail(AISLE, 3) == true if (f.seatsAvail(AISLE, 3)) displayFlights.add(f);

  6. f.seatsAvail(AISLE, 3) == true f.seatsAvail(AISLE, 3) == ? f.seatsAvail(AISLE, 3) == true true for (Flight f : flights) f.seatsAvail(AISLE, 3) == true if (f.seatsAvail(AISLE, 3)) displayFlights.add(f);

  7. memoized int f() { f() return g() + 1; } g() memoized int g() { … }

  8. top(N,i,j) top(N,i,k 0 ) top(N,k 0 ,j) top(N,i,k 1 ) top(N,k 1 ,k 0 )

  9. • •

  10. • • commit commit at 4 p.m.

  11. top(N,i,k 1 ) commit commit at 4 p.m. top(N,i,k 1 ) == top(N,i,k 1 ) ==

  12. top(N,i,k 1 ) commit committed top(N,i,k 1 ) == top(N,i,k 1 ) ==

  13. • •

  14. • •

Recommend


More recommend