Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. Exercise 1
  2. Define a class named Node with the appopriate fields and constructors.
  3. Write a Java application to construct TWO(2) object nodes with integer
  4. values of 4 and 7. Print the values and memory addresses of the nodes.
  5.  
  6. Exercise 2
  7. Define a class named as LinkedList with appropriate fields and constructors.
  8. Include a method called isEmpty() and write a Java application to test the method.
  9.  
  10. Exercise 3
  11. Write the complete definition of the following methods:
  12. a. insertAtFront();
  13. b. getFirst();
  14. c. getNext();
  15.  
  16. Exercise 4
  17. Write a Java application to insert THREE(3) integers 8, 10, 66
  18. using insertAtFront(). Print and observe the output.
  19. *note: the output should be 66,10,8
  20.  
  21. Exercise 5
  22. Write the complete definition for method insertAtBack() and insert
  23. another THREE (3) integers 68, 3, 1. Print and observe the output.
  24. *Note: The output should be 66, 19, 8, 68, 3, 1
  25.  
  26. Exercise 6
  27. Write the complete definition for method removeFromFront() and remove a node.
  28. Print and observe the output.
  29.  
  30. *Note: The output should be 10, 8, 68, 3, 1
  31.  
  32. Exercise 7
  33. Write the complete definition for method removeFromBack() and remove
  34. TWO(2) nodes. Print and observe the output.
  35. *Note: The output should be 10, 8, 68
  36.  
  37. Exercise 8
  38. Write a Java application to test the LinkedList class and
  39. perform the following:
  40. -Insert TEN (10) integers
  41. -Calculate the sum
  42. -Find the minimum and maximum.
  43. -Compute the average.
  44. -Count the number of odd and even integers.