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)) displayFlights.add(f);
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);
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);
memoized int f() { f() return g() + 1; } g() memoized int g() { … }
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 )
• •
• • commit commit at 4 p.m.
top(N,i,k 1 ) commit commit at 4 p.m. top(N,i,k 1 ) == top(N,i,k 1 ) ==
top(N,i,k 1 ) commit committed top(N,i,k 1 ) == top(N,i,k 1 ) ==
• •
• •
Recommend
More recommend