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!
Re: linked list to print starting from middle then right to left
Re: linked list to print starting from middle then right to left
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.
Re: linked list to print starting from middle then right to left
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;
.
.
.
}
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.
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 :confused: store a sequence in a linked list :confused: 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?
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?
:blush: Sorry, thought it was directed toward me, but you are right. He needs to show us his implementation.