recursively, it's reverse(tail(list)) + head(list)
2006-09-18 20:22:36
·
answer #1
·
answered by jake cigar™ is retired 7
·
0⤊
0⤋
steps:
1.take the count as 0
2. traverse the list from beginning and store it in the array and increase the count
3. display the strings of array 0 to last count
please correct if i am wrong
2006-09-18 20:25:51
·
answer #2
·
answered by venkatesh 2
·
0⤊
0⤋
Roll-your-very own LinkedList makes me go-eyed. I would desire to have the variables head and runner ==> runner = head; ==> runner = runner.next; have faith it or do not ... recursion is meant to be the least puzzling thank you to LIFO a LinkedList. i will purely advise the answer. i can't save on with a homebrew linkedList until eventually I wrote it.
2016-12-15 10:20:26
·
answer #3
·
answered by Anonymous
·
0⤊
0⤋
reverse the node pointers,then traverse through the list
2006-09-19 18:22:41
·
answer #4
·
answered by Anand 3
·
0⤊
0⤋
If your course have not get to Recursion a for loop would do:
LLNode temp = head;
LLNode result = null;
for (int x = 0; x < head.size(); x++) {
LLNode rest = result;
result = new LLNode(temp.data());
result.addTrain(rest);
temp = temp.next();
}
2006-09-18 20:30:14
·
answer #5
·
answered by Andy T 7
·
0⤊
0⤋