Results 1 to 9 of 9

Thread: linked list to print starting from middle then right to left

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    3

    linked list to print starting from middle then right to left

    this is my very first java program and i have an idea on how to do this but i don't have the concepts down.......i need to store a sequence in a linked list and print them on the screen starting from the middle and then from the left and then the right....example: 103 23 4 13 21 18 19= 13 4 23 103 21 18 19

    if someone could just point me in the right direction i would GREATly appreciate it!!!

    thanks!

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: linked list to print starting from middle then right to left

    We don't do ur homeworks
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    3

    Re: linked list to print starting from middle then right to left

    i wasn't asking for that

  4. #4
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: linked list to print starting from middle then right to left

    Print out the middle.
    Then a normal for loop to print from left to right.
    A 'descending' for loop to print right to left.

  5. #5

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    3

    Re: linked list to print starting from middle then right to left

    thanks!!!

  6. #6
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: linked list to print starting from middle then right to left

    That's not a linked list program.
    A linked list class is supposed to link to the next element (optionally the previous one)
    each class object has a value
    public class A{
    private A next;
    private int value;
    .
    .
    .
    }
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  7. #7
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: linked list to print starting from middle then right to left

    Quote Originally Posted by ComputerJy
    That's not a linked list program.
    A linked list class is supposed to link to the next element (optionally the previous one)
    each class object has a value
    public class A{
    private A next;
    private int value;
    .
    .
    .
    }
    Your point? Loops/Iterators will work just fine if you know what you're doing.

  8. #8
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Cool Re: linked list to print starting from middle then right to left

    Quote Originally Posted by rain4444
    this is my very first java program and i have an idea on how to do this but i don't have the concepts down.......i need to store a sequence in a linked list and print them on the screen starting from the middle and then from the left and then the right....example: 103 23 4 13 21 18 19= 13 4 23 103 21 18 19

    if someone could just point me in the right direction i would GREATly appreciate it!!!

    thanks!
    My point is: Where the hell is the linked list representation?
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  9. #9
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: linked list to print starting from middle then right to left

    Quote Originally Posted by ComputerJy
    My point is: Where the hell is the linked list representation?
    Sorry, thought it was directed toward me, but you are right. He needs to show us his implementation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width