Java Programming

Kick back and relax. Anything that does not have to do with footbag goes here!
Post Reply
User avatar
BalinorNZ
Post Master General
Posts: 2766
Joined: 26 Jul 2003 03:24
Location: Dunedin, New Zealand

Java Programming

Post by BalinorNZ »

Anyone here a computer scientist?
I am doing a paper this semester on Java programming.
Got an assignment coming up on Binary Search Trees.

Anyone an expert? Feel free to discuss your thoughts on Java or BSTs in this thread!
HG
^^^^^pwn3d
Posts: 4730
Joined: 14 Jul 2004 09:09
Location: pm for info

Post by HG »

Maybe Stephen Blair knows something about it. PM millenniumtree on the forum
JSACK wrote:alright well me and obara'bars, shredded our dicks off, since we are both in high school, obviously there is some sort of talent show
User avatar
bob
Le Meurtre Faux
Posts: 518
Joined: 30 Apr 2002 12:55
Location: parkersburg, west virginia

Post by bob »

i'm in computer science, but i haven't done binary search trees in so long that i barely remember anything about it. any other questions though, feel free to ask via PM.

bob
Bob Glasser
User avatar
max
Australofrenchbrityorkus
Posts: 3751
Joined: 24 Apr 2002 00:12
Location: Bondi Beach, Australia
Contact:

Post by max »

http://www.cs.mcgill.ca/~cs251/OldCourses/1997/topic9/

this should help
They have a java applet at the bottom too. With the source code.
Maxime Boucoiran
French ConneXion
BFC
User avatar
Splint
Angry Hippy
Posts: 2095
Joined: 27 Oct 2003 13:58

Post by Splint »

You might ask Tsiankgun as well. Damon too if you have his e-mail address.
Old Skool
User avatar
Tsiangkun
Post Master General
Posts: 2855
Joined: 23 Feb 2003 02:27
Location: Oaktown

Post by Tsiangkun »

check out the classes in java.util.

There should be a binary tree class, or something that can be used to make one.
User avatar
millenniumtree
Multidex Master
Posts: 274
Joined: 09 Aug 2004 21:24
Location: Stoughton, WI
Contact:

Post by millenniumtree »

Ooh, OOH!!

Java is my favorite language, by far.

Binary search trees are nifty. They are basically a way of arranging data in what looks like an upside down tree (with the root on top)

Basically at every branch of the tree, there is a high side and a low side. Everything that is connected to one side of the tree is higher than everything on the other side. This makes searching for a particular value very easy, because you only have to traverse through a small number of points to find the correct object in a tree of hundreds.

If you have any questions about Java, or any other programming langauge for that matter, I would be more than happy to answer them. :D

I've done programming in Basic, PHP, C/C++, Java, ASP, ASP.NET, C#
Stephen Blair
Stoughton, WI
Footblog | Blog | Boring Website
User avatar
jon
Foosebag God
Posts: 2299
Joined: 10 May 2003 23:33
Location: Guelph, Ontario, Canada.
Contact:

Post by jon »

3 courses left and I am done my compsci undergrad :) but working at RIM for the next little while so dont know when I will finish :p hopefully the fall or winter

thoughts on java:
great language for teaching programming, kids, compsci students just beginnings, scientists that dont wanna learn heavy coding ect
object oriented is great and very useful to learn, java provides a good plateform for leaning oo stuff
I like the debugging and how cross plateform it is, windows, linux, toasters, pdas ect...
great documentatin and support for the language

cons: slow, therefore not for some scientific uses or for a lot of commerical programs, SLOW = the biggest problem

thoughts on binary search trees
a tree is a tree (kinda), there are better trees for searching that are more efficient and faster but trees in general are very useful (ie huffman compression and jpgs!)
kinda of a hard question to answer because its so broad

more specific questions would be helpful
goodluck on the assigments
Jon's FootBlog
MSN: [email protected]
"It was clean enough to be thin..." - Andrew W.
comastalker
BSOS Beast
Posts: 373
Joined: 02 Mar 2004 10:00
Location: germany - leverkusen
Contact:

Post by comastalker »

well this is imo one of the ugliest things to do in java.
I like java, but I hate hidden pointers.
C++ is the best language to go, though I'm also able to help in JAVA, (Object-)Pascal, Delphi and OpenGL as well as math stuff.

A binary tree in c++ would somehow look like

Code: Select all

struct SNode
{
    [vartype] data;  // if you want to hold integers, go for int value or so...
    SNode* leftChild;
    SNode* rightChild;
}


// intialization :
SNode root;
root.value = 0;
root.leftChild = NULL;
root.rightChild = NULL;

// adding a child to the right branch of root.rightChild
root.rightChild->rightChild = new SNode;
root.rightChild->rightChild.value = x;
etc.....

// deleting is like : 
delete root.rightChild->rightChild;
root.rightChild->rightChild = NULL;
in a binary search tree, the value hold in a right child is always higher than the current node and the value in the left child is less than the current node.
So to search for a value you do following

Code: Select all

(- start with root)
- For the current node :
  - if the value in the current node is the needed one
    - return true
  else 
  if needed value > current Value
    if rightChild == NULL then // nothing found
    else repeat everything with current->rightChild
  else 
    if leftChild == NULL then // nothing found
    else repeat everything with current->leftChild
-Richard Vock-

"And today the great Yertle, The Marvelous he,
Is King of the Mud. That is all he can see.
And the turtles, of course...all turtles are free
As turtles and, maybe, all creatures should be."
- Dr. Seuss
comastalker
BSOS Beast
Posts: 373
Joined: 02 Mar 2004 10:00
Location: germany - leverkusen
Contact:

Post by comastalker »

the cross platform thing is really nice but there is a lack of (for me, as a game programmer) really essential things :

- templates (well in 2.0 they shall be implemented)
- operator overloading (it's so damn useful)
- sscanf() best function ever....
- a good inline assembler (like in MSVisualStudio)
-Richard Vock-

"And today the great Yertle, The Marvelous he,
Is King of the Mud. That is all he can see.
And the turtles, of course...all turtles are free
As turtles and, maybe, all creatures should be."
- Dr. Seuss
User avatar
travismontoya
BSOS Beast
Posts: 356
Joined: 28 May 2005 21:00

Post by travismontoya »

I know this is a old thread but I had to post on this considering ive been programming for 3 years, I hate C++ even though its OOP its just ugly and Bleh even the writer himself said he hated it, C is the way to go, Its widely used by EVERY programmer that knows what hes doing I mean, all of the GNU based programmers majority are in C, Assembly is great to, and I dont even want to talk about java because its just to much shit there is no pros with it other then that its easy as cake....

Sorry I know this has nothing to do with the topic but just had to post :)
User avatar
travismontoya
BSOS Beast
Posts: 356
Joined: 28 May 2005 21:00

Post by travismontoya »

And crap sorry bout the double post but all these edits are turned off for some reason... I just wanted to say my experience with programming, I was a porter for freebsd and a archlinux tur user, I program in alot of languages including the following some are scripting...

C/C++, Java (hate it), ASM (x86), PHP/MYSQL, Python, Perl, ruby

:)
comastalker
BSOS Beast
Posts: 373
Joined: 02 Mar 2004 10:00
Location: germany - leverkusen
Contact:

Post by comastalker »

does c support templates ? afaik it doesn't...
-Richard Vock-

"And today the great Yertle, The Marvelous he,
Is King of the Mud. That is all he can see.
And the turtles, of course...all turtles are free
As turtles and, maybe, all creatures should be."
- Dr. Seuss
Post Reply