Overview
This week we will conclude our crash course in Ruby that we began last week, and begin using it to study computer science.
I'll be out Friday, April 11th, so we will have this last assignment of the quarter due on Wednesday, April 9th.Friday, April 11th
Next Project and Project Pairs
I'm out today, and I know several of you told me you would be out too. So think of this as your early introduction to what we will be working on during our first class after we return from Spring break on Wednesday, April 23rd.
Our task will be to implement a binary search tree in Ruby. You will work in the following pairs to complete this project:
- Anar and Adonis
- Akshay and Cody
- Luis and Mulbah
- Ved and Turner
- Jamethiel and Caleb
- Isaac and Marin
- Anfal and Trostin
- Parker and Johan
These pairs were not random, but were instead intentionally choosen by me as
clique breakers
with an eye toward combating Senioritis. We'll see how
well I did ;-)
BSTs with Paper and Pencil
We want to create a BinarySearchTree
class with the following
methods:
insert(value)
: Inserts a value into the BSTsearch(value)
: Returns true if value exists in the treedelete(value)
: Removes a value from the treein_order_traversal
: Returns array of values in sorted orderpre_order_traversal
: Returns array in root-left-right orderpost_order_traversal
: Returns array in left-right-root ordermin
: Returns the minimum valuemax
: Returns the maximum valueheight
: Returns the height of the tree- empty?: Returns true if tree has no nodes
Before you can implement these in code, you should practice doing them on paper by hand. Use your class time today to do just that.
Monday, April 7th and Wednesday, April 9th
Classwork / Homework
We'll begin class today by having students share where they are in their Ruby study. Except for the three students who have already presented (Akshay, Trostin and Caleb), the rest of you will be selected one by one at random to share your work. We'll do this as long as both time and our attention spans permit.
Then we will start using Ruby in our study of data structures and algorithms. When we left off in C++ we were beginning to study binary trees. We will resume that study now, using Building a Binary Tree with Enumerable to get us started, and implementing a binary search tree as our first project.
Tuesday, April 1st and and Thursday, April 3rd
Classwork / Homework
We will continue to work in the learning groups below for the remainder of this quarter. I recommend using The Odin Project Ruby Course as your main resource. If you encounter any problems with the old ruby version on your school laptops, I found several online interpreters you can use.
At the beginning of class on Tuesday we will discuss how this assignment will be evaluated.Learning Groups
- Turner and Parker
- Akshay, Marin, Trostin and Anar
- Anfal, Adonis, Isaac and Jeff
- Jametheil, Cody and Caleb
- Luis and Mulbah
- Ved and Thomas
- Johan and Gabriel