Monday, January 14, 2013

The PCS Tree

Data structures are always interesting to me. The ability to store data in certain ways so that they could have special inherent features, such as fast search, or fast access, ... etc, is very exciting and rewarding. As professor Keenan mentioned, computer science and software engineering are all about moving data around, period. Finding the most convenient data structure to represent the data and efficiently implement the task at hand is all that matters.

The PCS Tree is really great for representing any hierarchy of objects. It reminds me of the Composite Design Pattern which I used in SE456 to represent the the hierarchy of collision boxes in the Space Invaders game. However, the PCS Tree is very generic, you don't need to write your objects in certain class hierarchies to implement the composite pattern. Just have your data object inherit from the PCSNode class, and it's then possible to add it to the PCS Tree.

This assignment wasn't hard, but it was very important as it served as a very good warming up for what's next. After 6 months of being far away from C++, and working with only managed languages such as Java and C#, C++ gets rusty and forgotten. C++ is a real big ocean, now one can really surround all of its knowledge, But once I start coding in it, I start to remember things little by little and appreciate the closeness it gives me to the machine. At that moment I realize how much I love C++ and how much I wish I could learn more about it. This class is going to be very challenging but I'm sure it's going to be very rewarding at the end. And as the Cadillac ad. said: "Welcome to the world of gentlemen, gentlemen!"

What I liked about the PCS Tree assignment:

1- Unit tests were provided so we make sure we're on the right track.
2- A great opportunity to practice my understanding of recursion and recursive methods.

I also like the way I implemented the dumpTree() method. I wrote it so that it prints the tree in sideways. So this hierarchy:


is printed out sideways as this:



I'm worried about the memory system .. we'll see how that will go ...



No comments:

Post a Comment