Algorithms and OOD (CSC 207 2014S) : EBoards
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Overview
Is there a way to compare two trees?
I have not written a comparator for trees. You could write one. It will probably look something like the following.
public static boolean equals(BSTNode one, BSTNode two) { // Base case one: Both are the same node. Obviously the same tree. // Also covers the both are null case. if (one == two) return true; // Base case two: One, but not the other is null. Different trees. else if ((one == null) || (two == null)) return false; // Recursive case: Both are nodes else return (one.key.equals(two.key)) && (one.value.equals(two.value)) && (equals(one.smaller, two.smaller)) && (equals(one.larger, two.larger)); } // equals(BSTNode, BSTNode)
Should we copy values or move nodes in rearranging trees?
Move nodes. It ends up working better in the long run, at least if I trust my experience and intuition.
When given an algorithm design problem, how do you get started?
How Sam tends to approach algorithm design.
Much later
Sam's basic questions on ADT design:
When given a data-structure design problem, how do you get started?
What are Sam's basic questions on data structure design?
"Design Patterns"
Ways of thinking about common problems.
A language for expressiong common solutions.
I expect you to know (and have seen)
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Rubric] - [Calendar]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Examples] [Handouts] [Labs] [Outlines] [Partners] [Readings]
Reference: [Java 7 API] [Java Code Conventions] [GNU Code Conventions]
Related Courses: [CSC 152 2006S (Rebelsky)] [CSC 207 2013F (Rebelsky)] [CSC 207 2013S (Walker)] [CSC 207 2011S (Weinman)]
Misc: [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] [Issue Tracker (Course)] [Issue Tracker (Textbook)]
Copyright (c) 2013-14 Samuel A. Rebelsky.
This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this
license, visit http://creativecommons.org/licenses/by/3.0/
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.