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).
 
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
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...
Back
Top