jump to navigation

Code Code Code January 27, 2011

Posted by Brardith in Uncategorized.
Tags: , ,
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.

Advertisement

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.