Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is about Data Structure & Algorithms Analysis in C Linked List ADT. Delete Implement Code below : void delete( element_type x, LIST L )

This is about Data Structure & Algorithms Analysis in C

Linked List ADT. Delete Implement Code below :

void

delete( element_type x, LIST L )

{

position p, tmp_cell;

p = find_previous( x, L );

if( p->next != NULL )

{

tmp_cell = p->next;

p->next = tmp_cell->next;

free( tmp_cell );

}

}

Question 1. Am I thinking right that not executing 'malloc' to tmp_cell is because we are 'free'ing tmp_cell so that we do not have to worry about memory usage ?

Question 2.

tmp_cell = p->next;

p->next = tmp_cell->next;

free( tmp_cell );

can i change the code above to the below one ? (not using tmp_cell)

if not possible, tell me why i can not change light below.

p->next=p->next->next

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What do you understand by MBO?

Answered: 1 week ago

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

Define span of management or define span of control ?

Answered: 1 week ago