Adam Ellsworth

Greenhorn
+ Follow
since Sep 25, 2004
Merit badge: grant badges
For More
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 Adam Ellsworth

I'm trying to create random numbers(which is working fine) but I need to get them to output to a file to be read later on.



Thats what I'm trying to do now, but nothing is getting put into the text file. Obviously I'm doing something wrong so any help would be appreciated. Thanks.
19 years ago
Yeah, just figured that out, hehe. But now the algorithm he gave us isnt doin much

here's the code he gave us. I'm sure i'm doing something wrong opposed to his code being wrong.

19 years ago
I'm writing a program to compare the effiecency between heapsort and bubblesort. We were givin the code for both of the sorts and have to use them. The only problem is the code contains Object arrays and I'm not sure how to put integers (we have to make the arrays for testing) into the Object array coding. I created the integer arrays by using a simple for loop with a random number generator which works fine. Any help to tell me how to put ints into Object arrays would be appreciated. Here is the heapsort algorithm we were given that we have to use:



Here is how I am creating my random integer array:

19 years ago
Ok, I figured out that I had to make an iterator and it worked, lol. Sorry for botherin ya guys Have a good day!
19 years ago
I got the int part to work. I just used new Integer(i) instead of setting i to value. Still trying to figure out how to print out each line seperately so any help is appreciated, lol. Thanks again
19 years ago
1) I need to output to a file in ascending order, one key:value per a line. I can make it output to the console but only the whole map all at once.
i.e output looks something like this:
<a:1, about:5, around:7, ...>
Is there a way to make it printout 1 key at a time?

also...

2) I also need to make the value an integer but it's not liking that too much, lol. The program is to input song lyrics from a file and output each word and what line it appears on. Obviously the line it apperas on is an int, but the treeMap won't take that. Is there a way to put an interger in as the value?

Heres my code by the way:
19 years ago
Thanks for your help Jimmy Your suggestion unfortunately didn't work either. Sorry for the very vague question and sloppy code. I was in a hurry and didn't have too much time to do anything I ended up appending the text file and it kind of worked. It would output to the console perfectly, but the output to the text file was all screwy, but at least it outputted something The program was turned in today and I can post the results on how to make it work if anyone cares to see, hehe. Thanks again, Adam
19 years ago
Sorry, don't use that code, the output is hard to follow. This is a little better...

19 years ago
I have a binary search tree and need to output it before it clears to create the next one. I can output strings in the main but can't figure out how to put anything dealing with the tree to the outputted text file. Here's my code, please help, hehe. Thanks

Code:

19 years ago
Ok, makin some progress. I have three things to fix before its complete though. Here they are:

1) How do you clear/make a new tree when I encounter the "%Unit5-7"? Need to make seperate trees, not 1 big one

2) The treeContains() needs fixed to check for duplicate nodes. Instead of making a list or an array, I kinda took the short cut. Instead of putting the english word node in, then the Latin node, I simply combined them and made it into one string making one node. Only problem with that is it causes the treeContains() not to work because it only searches for the english word, not the whole string.

3) I need to output it to a file but can't do it. I can't even do something like out.write("Blah"); Nothing appears in the file. You can check my Stream in the code below. I need to be able to output the tree and just lines. Heres the code:

19 years ago
Just got the email back and we aren't allowed using treeMaps,I knew they were too good to be true, lol. I was thinking about how to use a regular tree for this and was wondering if it would be possible to do something like this:




I know what I'm thinkin, just having trouble explaining it Would it be possible to add a third "pointer" to an eglish node and just not "visit" it when printing them out in order? Let me know if you know what I'm talkin about, cause I know it sounds confusing
19 years ago
Thanks for the help

I'm usually not one to complain about professors, but this one is absolutely terrible He doesn't teach at all and refuses to answer any questions. A class consists of him READING straight off of the powerpoint presentataion the that the books company sent him So currently I'm trying hard to teach myself how to use the treeMap. Think I got everything stored in there so far but still having troubles adding a latin word to an already exsisting english word. Also havin trouble writing to the file.

It is a data structures class but I sent him an email today asking if we could use treeMap...he didn't answer yet, go figure, hehe.

Here is my code so far, it is very rough at the moment and not working too smooth, so bear with me and yell at me if I'm headed in the wrong direction anywhere, hehe.

19 years ago
"Attached to each English word is a list of one or more Latin words."

Thats what I can't figure out how to do. Do I have to use the treeSet for that? Or is it possible to associate a linked list with a node without using it?
19 years ago
Sounds like TreeMap would be useful, but unfortunately, I think we do have to build our own BST. Still not gettin how to store them, but I'll try to work backwards like you suggested and see how that works. Thanks for the help, I'm sure I'll be back, lol.
19 years ago
I mixed up the 'before' and 'arms' nodes, they should be switched to make it a working binary search tree Just sayin to let ya know that I kind of know what I'm talkin about, hehe.
19 years ago