60 likes | 69 Views
Learn important tips for managing memory in linked lists. Nodes are created on the heap and tracked with pointers. When creating new nodes, remember that a pointer is required to store the address. Be mindful of deleting nodes to avoid losing track of memory allocation. Ensure one delete operation per new node, not per pointer used.
E N D
Node Use • Linked List Nodes: • Nodes created on heap, tracked w/pointer
Nodes, New & Pointers • new requires a pointer to store address
Nodes, New & Pointers • new requires a pointer to store address • Not every pointer requires new memory
Delete • Must delete node before we lose track of it
Delete • One delete per new, not per pointer