Sale!

CS 46B Homework 7: Linked Lists

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (3 votes)

In this homework you will implement find() and duplicate() methods for a linked list class. To
keep things simple, the list class and its node class aren’t generic. The data of each node is one
char, stored in a CharNode class that is provided. In the Eclipse workspace of your choice,
create a new Java project containing package “linked” and add to it the 3 provided source files.
The method requirements are:
• public CharNode find(char ch) – Returns the first (i.e. closest to the head) node in
the list whose data is equal to ch. If there is no such node, returns null.
• public void duplicate(char ch)– Finds the first node in the list whose data is equal
to ch. Returns if there is no such node. If the node is found, creates a new node containing the
same data, and insert that node into the list either immediately before or immediately after
the found node.
The CharNode starter file contains a hasIntegrity() method that checks some (but not
all) aspects of list integrity. Use it (maybe in assert statements) in your find() and
duplicate() methods if it will help.
This is a win-or-lose assignment. If your code passes the graderbot (class LinkedListTester),
you get 100 points. If your code fails any part of the graderbot, you get zero points. As always,
work will not be accepted after the deadline.