alext1899 alext1899
  • 19-07-2019
  • Computers and Technology
contestada

Deleting anitem from a linked list is best when performed using two pointersso that the deleted item is freed from memory.
a.True
b. False

Respuesta :

ExieFansler ExieFansler
  • 25-07-2019

Answer:

a.True.

Explanation:

To delete a node from linked list it is best to do it by using two pointers suppose say prev and curr. Iterating over the linked list while curr is not NULL and updating prev also.On finding the node to be deleted we will set the prev so that it points to the next of curr and after removing the link we will free curr from memory.

line of code for deleting a node in c++:-

prev->next=curr->next;

delete curr;  or  free(curr);

Answer Link

Otras preguntas

Persuasive exposition writing:Endangered Animals Need Our Protection.
How many packages will 5 1/2 pounds of raisins fill if each package holds 9 ounces
This element is a liquid at room temperature. (A) Hg (B) Th (C) Na (D) Cl (E) Co
How does matter and energy move through the water cycle
-87 1/8 as a decimal number
In what areas did Americans push for reforms?
In a necklace the ratio of yellow beads to blue beads is 3:1. What percentage of beads are yellow?
what are two european countries that are great for studying
Tabitha has 4 music files each with 9 songs in it. she is dividing the songs into 7 groups. if each of group will have the same number of songs how many songs w
Unlike Britain, France, and Russia, the United StatesA. controlled large areas of China.B. wanted to keep trade in China open.C. had no interest in trade with C