Code Code Code January 27, 2011
Posted by Brardith in Uncategorized.Tags: Coding, Java, School
trackback
So, I’m still attending grad school here at SDSU. Almost done! Among my last classes are Emergent and Adaptive Computing and Object Oriented Programming methods.
My first assignment for the second, my first big one, is quintessential for the professor. Make a max heap without any arrays! So of course I’m moving to a tree format. Or more like a linked list with Nodes that can accommodate a value, and record what their parent and two children are.
But it doesn’t stop there, oh no. There are special rules for adding new values, it’s not sorted per se, but it’s “if left subtree has more than right subtree, put it in the right subtree, otherwise put it in the left.” And I also need to print the whole tree presorted, and JUST THE ODD NUMBERS presorted. Also there is some unclearness as to what KIND of numbers I need to use. But uhgggggh.
It’s been a long time since I worked with Java. I found myself asking my buddy “But wait, how can I dynamically make my new nodes? Don’t I have to specially name them all?!” Durrrrrrrrr.
Node newNode = new Node();
maxHeap.add(newNode);
durrrrrrrrrrr.
This is the problem with working in academia, with so many languages and so much theory now as opposed to practical programming. I almost forgot how to javaaaaaaaaaa.
Comments»
No comments yet — be the first.