Lockheed Martin Interview Question

What is the difference between a shallow copy and a deep copy?

Interview Answer

Anonymous

Mar 26, 2023

Shallow copy: Creating pointers that point to the original data structure. For instance, creating a new LLpointer node that points to the head of the original linked list. Deep copy: Copying the entire data structure and its values. For instance, making a new linked list and copying all the node values.