This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes insertion of data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "insertion of data" Watch "insertion of data" New topic
Author

insertion of data

Timothy Leong
Ranch Hand

Joined: May 25, 2005
Posts: 55
hi guys,

I did the following coding.
can you help me to check if this is an insertion sort linked list?? the node are inserted in ascending order of name. thanks alot


Jeff Langr
author
Ranch Hand

Joined: May 14, 2003
Posts: 762
Unfortunately I can't tell what the bold portion is. You might want to clarify by sticking a comment in your code section.

You might try writing some tests to see if the code has the expected behavior. Either make a bunch of calls in a main method or look at JUnit.

-Jeff-


Books: Agile Java, Modern C++ Programming with TDD, Essential Java Style, Agile in a Flash. Contributor, Clean Code.
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
I suggest that you test this out yourself. Start by writing a driver class that has a main() method. Then you can write code that calls the method that you have shown here. Then write some additional code to assert that it has the behavior to expect. The simplest way to do so is to just print out the results to the screen and compare it manually with what you expect to happen. If you want to get more sophisticated, you can add code that compares the results with an expected value automatically and just prints out a pass or fail message.

If this isn't entirely clear, show us some more code for the class that contains the method that you have written. I can help you fill in the details from there.

Layne


Java API Documentation
The Java Tutorial
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: insertion of data