Assignment Instructions
Instructions:
* Make sure you go to this week’s chapter lesson for more guidance.
This assignment involves using recursive method. Write a program that reverses a LinkedList.
Save the code in jGRASP, then save it in c:\myjava and run it.
/*******************
Name:
Date:
Notes:
*******************/
// Java program for reversing the linked list
class MyLinkedList {
static Node head;
static class Node {
int data;
Node next;
Node(int d) {
data = d;
next = null;
}
}
/* Function to reverse the linked list */
Node reverse(Node node) {
add content
node = prev;
return node;
}
// prints content of double linked list
void printList(Node node) {
while (node != null) {
System.out.print(node.data + ” “);
node = node.next;
}
}
public static void main(String[] args) {
MyLinkedList list = new MyLinkedList();
add content }
}
Make sure that you include all source codes and the compiled codes into W7_firstname_lastname.zip.
You must leave me a note in the Submitted Text area on how to compile and run your code.
Requirements
Points Available
Assignment details in a comment block (flowerbox)
10
Core application as described in the assignment requirement
60
Print function used to correctly to print the solution to the assignment
20
Code is commented and application name is submitted as requested
10
Total
100