2-3-4 Trees Continued

October 15, 2012

Ambient Temperature: 72.9oF Concepts 2-3-4 Tree Powerpoint, slides 18 -> 20 When implementing a self-balancing 2-3-4 tree (or any complex data structure, for that matter), think before you code. Take the time to devise solutions that decouple interfaces from implementation, and that separate the variant and invariant behaviors. When applying code to those solutions, again […]


Lecture 20: Extended Visitor Design Pattern

October 8, 2012

Ambient Temperature: 74.1oF Concepts Extended Visitor Design Pattern: Instead of a host calling visitor.this_type_of_host_case(…), the host can call visitor.case_for_host( host_type, parameters… ). This allows your visitor to have a set_case_for_host( host_type, ICase _case ) method that will add behavior to the visitor for the specified host type. The end result is that you can support […]


Lecture 19 Part 3: More Visitors

October 5, 2012

Ambient temperature: 74.5oF Concepts There are three approaches to the “sum” algorithm on the NEList/MTList list structure: nonEmptyCase(…) { return MY_VALUE + rest_of_list.execute( this ); } This is TAIL recursion, and accumulates the return value on the STACK. Another name for it is “Forward Accumulation.” nonEmptyCase(…) { return rest_of_list.execute( this ) + MY_VALUE; } This […]


Lecture 19 continuted: More Visitors

October 3, 2012

Ambient temperature: 74.4oF Concepts Dr. Wong demonstrates the visitor design pattern: The HostA-HostB-HostC visitor pattern from last class’ lecture. Linked Lists with counting, summation, copying, and mapped addition. The visitor pattern is an example of “double dispatch:” First the visitor object is dispatched to a host object, then a particular method is dispatched from the […]


Lecture 19: Visitors

October 1, 2012

Ambient Temperature: 73.8oF Concepts A representative from Palantir Technologies came to talk about their company and encourage attendance of their info session tonight from 5:30pm to 6:50pm in Duncan Hall 1064. The advertised dinner will consist of Star Pizza. Interpreter Design Pattern: An abstract class for a category of objects defines an abstract interface that […]


Lecture 16: More of Lecture 15 (Collisions)

September 28, 2012

Ambient temperature: 73.5oF Concepts It is entirely possible to make incorrect design decisions, and these can fairly easily be identified. However, there are often multiple correct answers to a given design decision, and it is not always clear-cut which one is best. Dr. Wong implies that it is not as important to choose the best […]