Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

insertion of data

 
Timothy Leong
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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-
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic