SCENARIO:
Q1:
Implement a myStringBuilder class which works like the StringBuilder class. Your class will have:
- A single linked list
- append method to append anything
- 3 different toString methods which; o Uses indexes and get method o Uses iterator
o Uses toString method of the linked list
Write a main class which;
- Will read 100.000 integers from the txt file
- Uses myStringBuilder to create a string using 3 different toString methods
- Prints their output to txt, result2.txt and result3.txt files
- Analyzes and compares performances of 3 toString methods
Submit your code to moodle. Add detailed information about your test and performance analysis method. Write detailed analysis results in your report.
Q2:
Implement a reverseToString method for the SingleLinkedList class which will create a reversed String. Your method must work recursively.
Write a main class to test your method. Submit your code to moodle.
Q3:
Extend AbstractCollection class as myAbstarctCollection. Implement an appendAnything method for myAbstractCollection class which appends any AbstractCollection object to any other AbstractCollection object by concatenating them.
You will not test your code. Give more detail about this part in your report.
Q4:
Implement a SingleLinkedList class which reuses deleted nodes. That is, your class will keep deleted nodes. When required, instead of creating a new node, your class will use one of the deleted nodes. This way your class will do less garbage collection.
Your class will have a deletedToString method which creates a String of deleted nodes.
Write a main class to test your SingleLinkedList class by inserting 100 integers, deleting 50 of them and inserting 100 more integers. (You can read from a file.) Submit your code to moodle.
Reviews
There are no reviews yet.