Win a copy of Spark in Action this week in the Open Source Projects forum!

Marty Groban

Greenhorn
+ Follow
since Jun 25, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marty Groban

JTree isnt what im looking for. I need to draw a binary search tree as in Graph theory. I suppose JTree would work, but im only going to do that as a last resort. I still have time to figure out how to draw an actual BST.
9 years ago
I am working on a project for an online class I made the mistake of taking this summer and I need to build a gui to show how the huffman code algorithm works. The algorithm part is easy, its not very complicated. However im unsure what the best way to draw the tree(forrest) at each step. It would have to start out as just n nodes (with chars in them) on the screen and then you would press a "next" button and it would pick the two lowest nodes weighted (based on character frequency) characters and make them children of a new node (with just a weight - no char) and then update the screen/panel.

I have made swing gui before, my skills are nothing special but I know my way around. However im stuck on this implementation. I have a couple hundred lines of code written right now, but it doesnt work and I think its bad anyway, so I want to "start over" and plan it out better. So Id just like some advice on the data structure to keep track of the nodes and how to draw them on the screen.

I was using an ArrayList of JPanels as nodes and trying to draw them to a null layout. Im sure this is awful and id like to know a better way.
9 years ago
I would try to use a doubly linked list.
9 years ago
Here is this assignment I have to do for school. I have to use this bloom filter code and store 'a' to 'z' and 'Z' to 'A' (im good on that). then I have to check for false positives using "aa" to "zz" and "AA" to "ZZ" (not good on that). Here is my code so far.

Also, I realize you can't do what I did at the end there with the string loop, I just have that there to try and illustrate what I mean. That may or may not help.



What I need to know is how I am supposed to use aa to ZZ and check for false positives. I swear this is what the requirements say exactly, I just have no idea how to go about doing it.

Also, suggestions on my hash functions would be appreciated as well.
9 years ago