Description
You will need to submit a written report with part of your codes and your source code via Blackboard. You also need to bring in a hard copy of the report with part of your codes to the class on the day that this is due.
Name your header file as LastName(3 to 5 letters)_FirstNameInitial_HW3.h and your implementation file as LastName(3 to 5 letters)_FirstNameInitial_HW3.cpp
Note: You can only use iostream, cassert, cctype, cmath, cstdio, and cstdlib.
1. Create a class Node
a. Create a Node with data, i.e. constructor
b. The basic class Node functions, i.e. set, get, link(), etc.
2. Create a singly linked list. Create class/functions that:
a. Insert a Node in the front
b. Delete first Node
c. Insert Node at the end
d. Delete last Node
e. Return the size of the list
f. Delete all Node
g. Print all Node
h. Insert a Node at position i
i. Delete a Node at position i
j. Overload your insert functions so it can directly insert data
k. Get the Node at position i, i.e. locate
l. Get the Node with target data, i.e. search
m. Check if there a cycle
n. Swap two Node at position i and i+1, change the link and not the data
o. Swap two Node at position i and j, change the link and not the data
p. Reverse the whole list
q. (Extra Credit) Sort without creating a new list
Your report should consist of, but not limited to:
• Briefly explain what this function does
• Briefly explain how this function works, if applicable
• Pre- and Post-condition, if applicable
• Worst case time complexity
Example structures of the report:
1. An overview of this homework
2. Code for question 1
3. Explanation of question 1
4. Code for question 2
5. Explanation of question 2
6. … other questions
7. Any improvements, problems, etc. of the class/functions
8. Code for header file
Code should be Consolas font size 8 to 10.