Question: Suppose a singly linked list contains several nodes; each node has an object. Describe steps to delete the nodes which are smaller than the

Suppose a singly linked list contains several nodes; each node has an

Suppose a singly linked list contains several nodes; each node has an object. Describe steps to delete the nodes which are smaller than the average of all nodes. Your discretion of steps must work with any number of nodes. If you want, you can write the steps using Java syntax. Note: The size of each node can be obtained by the getSize() method, and the head is a reference to the head node of the singly linked list Head Node: 0 Head ref:Nodel 10MB ref:Node 2 Node: 1 10MB ref:Node2 2MB ref:Node 4 Node: 2 14MB ref:Node3 14MB The following figure shows how the singly linked list looks after deletion. null > 15MB Node: 3 ref:Node4 6MB Nede: 4 null 15MB

Step by Step Solution

3.38 Rating (139 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here are the steps to delete the nodes which are smaller than the average of all nodes in a singly l... View full answer

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!