Thursday, 13 March 2014

Binary Search Trees

Goooooooood Morning UofTTTTTTTTTTT,

I hope at least some of you understand my salutation reference. If not, do yourself a favour and watch Good Morning Vietnam.

This week we've gotten into the basics of Binary Search Trees. But i'll talk about that more later. I think I finally learned the basic, most important and profound lesson of CSC148 yesterday night at 10.37PM whilst working on e3.

"THINK THEN CODE!"

which for me translates into 

"DON'T EVEN THINK ABOUT BOOTING THAT COMPUTER TILL YOU KNOW HOW YOU'RE GOING TO SOLVE THE PROBLEM".

All along I've been trying to hack my way through the exercises and assignments, and while they were initially fairly simple and just required knowing how to work syntax, now the require actual problem solving. As a result, this lesson is becoming more and more important.

Now, back to BSTs (kinda sounds like STDs no (!) :p) Essentially I think what is crucial about BSTs is that we learn about the properties and use their properties to solve our problems. For example, suppose we wanted to implement a __contains__ method in a BST class. The dumb way to do it would be to traverse through every single node in the the tree and check if it's there. The smart way to do it would be to use the fact that BST entries are arranged according to size and halve the number of checks at each node.

Anyways, I need to go program now.

Bye,
Seigal 

No comments:

Post a Comment