Question: Ex 2.20 Let L be a (pointer to a) linked list. Suppose that each record r in the list has two fields: r.nert, which points

 Ex 2.20 Let L be a (pointer to a) linked list.

Ex 2.20 Let L be a (pointer to a) linked list. Suppose that each record r in the list has two fields: r.nert, which points to the next record, and r.data. Suppose that the records r where r.data = 0 are useless. Write a recursive routine Clean(L) that (recursively) cuts out all of the records in L where the data entry is zero. That is, it changes L to be the new list where the 0 records are removed This problem illustrates a type of pointer jumping. There are some problems where the solution as produced by the most natural and readable code -would be a list of sequential steps that might include unnecessary no-operations or skips. Simple pointer jumping can be integrated into the solution algorithm to produce a clean answer where these skips are removed. The only negative consequence is that the algorithm might become almost unreadable

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 Databases Questions!