Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Exercise 1
- Define a class named Node with the appopriate fields and constructors.
- Write a Java application to construct TWO(2) object nodes with integer
- values of 4 and 7. Print the values and memory addresses of the nodes.
- Exercise 2
- Define a class named as LinkedList with appropriate fields and constructors.
- Include a method called isEmpty() and write a Java application to test the method.
- Exercise 3
- Write the complete definition of the following methods:
- a. insertAtFront();
- b. getFirst();
- c. getNext();
- Exercise 4
- Write a Java application to insert THREE(3) integers 8, 10, 66
- using insertAtFront(). Print and observe the output.
- *note: the output should be 66,10,8
- Exercise 5
- Write the complete definition for method insertAtBack() and insert
- another THREE (3) integers 68, 3, 1. Print and observe the output.
- *Note: The output should be 66, 19, 8, 68, 3, 1
- Exercise 6
- Write the complete definition for method removeFromFront() and remove a node.
- Print and observe the output.
- *Note: The output should be 10, 8, 68, 3, 1
- Exercise 7
- Write the complete definition for method removeFromBack() and remove
- TWO(2) nodes. Print and observe the output.
- *Note: The output should be 10, 8, 68
- Exercise 8
- Write a Java application to test the LinkedList class and
- perform the following:
- -Insert TEN (10) integers
- -Calculate the sum
- -Find the minimum and maximum.
- -Compute the average.
- -Count the number of odd and even integers.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement