DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2006

    java program help

    hello everyone im helping my son who is stuck on writing a java assignment, however i have no clue whatsoever. i really want to help him but feel really helpless.

    i have attach the file so please take a look at it, write it, suggestion, tip, or just tell me where to start. It will be much appreciated.
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2003
    The word doc seems decently helpful, though slightly misguided. Here's how I would approach the problem:
    1) Make a class that implements the SelfOrgList interface.
    public class MoveToFrontSO implements SelfOrgList {
      Node listHead;
      public void clear() {
        // clean out the list, (set listHead to null)
      public int search(String word) {
    Here you will need to keep two references, one to the current node that you
    are inspecting and one to the last node that you inspected (just make a special case for the first node). If what you are currently inspecting is the word, then 
    1) set the next of the previous to the next of the current
    2) set the next of the current to listHead
    3) set listHead = current;
    return the number of inspections. If you reach the end of the list, multiply the number of inspections by -1 and return it.
      public void insert(String word) {
    Make a new node with this word as the string and the next equal to the front of the list. Set listHead = the new node.
    Hopefully this will get you started. The other algorithm is a little bit different, but shouldn't be too bad. If you have any more questions, just post them.

    Hope this helps.

Similar Threads

  1. Help! Simple Java Program.
    By SlickWilly440 in forum Java
    Replies: 2
    Last Post: 01-28-2006, 09:17 PM
  2. DevX does seem one sideded
    By Rob Abbe in forum Talk to the Editors
    Replies: 44
    Last Post: 01-13-2003, 02:57 PM
  3. Has Sun Given Up on the Desktop?
    By Lori Piquet in forum Talk to the Editors
    Replies: 114
    Last Post: 10-10-2002, 06:01 AM
  4. .NET vs. Enterprise Java: Who's Got Better Security?
    By Glen Kunene in forum Talk to the Editors
    Replies: 17
    Last Post: 03-23-2002, 12:43 AM
  5. Replies: 0
    Last Post: 11-16-2000, 12:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.