Question: Programming Homework 1 ( Due Sun, 6 t h Oct 1 1 : 5 9 PM ) Q 1 . Write a generic node class,

Programming Homework 1(Due Sun, 6th Oct
11:59 PM)
Q1. Write a generic node class, whose data is an array, arr, of length 10. The
array being of generic type T. The node class also maintains a variable n, which
is the amount of user data stored in arr. (So the node is not storing one, but
storing 10 data items as an array of type T --- yes, we can mix linked lists and
arrays).
Q2. Write a generic tailed linked list, that uses this node class. Add the private
member variables needed. I need you to complete just one method of this tailed
linked list: addLast(). The method adds another data item to the linked list. It
adds another node, only if the last node is already full, else it just adds one entry
to the array in the last node. (Handle the special case that the linked list is
empty, and you are adding the first item).
Q3. Modify the stack implementation by arrays, as follows. Write a function:
resize2(). This function is called from the pop function, if the length of user data
is smaller than 14 of the total size of the array. Then this resize2() function is
called, that resizes the array by reducing the array size by a factor of 0.6.(That is
size int
Programming Homework 1 ( Due Sun, 6 t h Oct 1 1 :

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!