MHB Separating a List: What to Do After Deallocating?

  • Thread starter Thread starter mathmari
  • Start date Start date
  • Tags Tags
    List
AI Thread Summary
When deleting a list from an array of linked-lists, it is essential to deallocate all nodes of the list to ensure proper memory management. After deallocating the nodes, the corresponding entry in the array should be set to NULL to indicate that there is no longer a list attached to that position. If the array itself is not dynamically allocated, no further action is required regarding the array. This process ensures a clean removal of the list and helps prevent memory leaks.
mathmari
Gold Member
MHB
Messages
4,984
Reaction score
7
Hey! :o

When I have to delete a list from an array of linked-lists, do I have to delete all the nodes of the list? Or do I have to do also something at the array??

There is a list, I have to separate this list into two others and delete the initial list from the array.

I used a function to deallocate the list. What else should I do?? (Wondering)
 
Technology news on Phys.org
mathmari said:
Hey! :o

When I have to delete a list from an array of linked-lists, do I have to delete all the nodes of the list? Or do I have to do also something at the array??

There is a list, I have to separate this list into two others and delete the initial list from the array.

I used a function to deallocate the list. What else should I do?? (Wondering)

Hi! (Blush)

To destroy everything cleanly, we should iterate over the array, and iterate over each list in the array, deallocating the nodes as we go. Then the corresponding entry in the array should be set to NULL to indicate there is no list attached to it anymore. (Nerd)

There is nothing else to do with the array (assuming it was not dynamically allocated).
 
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
Back
Top