You need to create new Book objects then put those in a new List:

List<Book> books_2 = books_1.Select(book => new Book(book.title)).ToList();

Update: Slightly simpler... List<T> has a method called ConvertAll that returns a new list:

List<Book> books_2 = books_1.ConvertAll(book => new Book(book.title));
Answer from Mark Byers on Stack Overflow
🌐
DaniWeb
daniweb.com › programming › software-development › threads › 321189 › c-deep-copy-linked-list
linked list - C++ Deep Copy Linked List | DaniWeb
Nice catch by @Fbody and @mike_2000_17: the head disappears because the copy-ctor built the new list into a local pointer, never into this->mHead, and you also never update this->mTail. You can avoid the head special-case entirely by building with a pointer-to-pointer and tracking the tail as you go. This preserves the source order (no sorting), which matches what you told @Lerner you want. // deep copy ctor: preserves order, no sorting OrderedSListT(const OrderedSListT& src) : mHead(NULL), mTail(NULL) { SNode **dst = &mHead; // where to write the next pointer for (SNode *cur = src.mHead; cur;
🌐
LeetCode
leetcode.com › problems › copy-list-with-random-pointer
Copy List with Random Pointer - LeetCode
Construct a deep copy of the list. The deep copy should consist of exactly n brand new nodes, where each new node has its value set to the value of its corresponding original node.
Discussions

c# - How create a new deep copy (clone) of a List<T>? - Stack Overflow
Personally I like to use a short ... the deep copy - de/serialisation is slow(ish), but this works no matter how many properties the object has. Unfortunately I'm on holiday so I can't just post the code. ... Save this answer. ... Show activity on this post. You need to create new Book objects then put those in a new List... More on stackoverflow.com
🌐 stackoverflow.com
struct - C++ Deep Copying Linked List - Stack Overflow
First of all, this is part of an assignment I'm currently trying to figure out. I'm trying to create a copy constructor that deep copies a given LinkedList. I have coded the LinkedList methods alre... More on stackoverflow.com
🌐 stackoverflow.com
How can I do a copy of a pointers list? C++
I have a list of pointers like ... copy list, but every change I do to my copy list, it's also seen in the original list. How can I avoid that? ... That' Qt, isn't it? I'm a bit confused right now, because you earlier said deep copying sounded advanced to you, on the other ... More on sololearn.com
🌐 sololearn.com
10
1
c - How to deep Copy this linked list - Stack Overflow
Hi I am having trouble making a method to deep copy this linked list I implemented. struct node_t { int priority,moves; int** data; // 2D matrix of integers struct node_t * More on stackoverflow.com
🌐 stackoverflow.com
May 7, 2016
🌐
Reddit
reddit.com › r/learnprogramming › [c] how to deep copy this linked list.
r/learnprogramming on Reddit: [C] How to deep copy this linked list.
May 7, 2016 -

Hi I am having trouble figuring out how to create a deep code of this struct I implemented.

struct node_t {
	int priority,moves;
	int** data; //2D matrix of integers
	struct node_t *prev_board;
};

What I have so far is trying to use recursion but I just can't get it to work.

void deep_copy(struct node_t* src,struct node_t* dest, int len) {
if (src == NULL) {
	dest = NULL;
	return;
}

dest = malloc(sizeof(struct node_t));
dest->priority = src->priority;
dest->data = (int **)malloc(len * sizeof(int *));
int r = 0;
for (r = 0; r < len; ++r) {
	dest->data[r] = (int *)malloc(len * sizeof(int ));
}
copy_v(src->data,dest->data,len); // This just copies the 2D Matrix values
deep_copy(src->prev_board,dest->prev_board,len);

}

But I also think I don't want to use recursion since stackoverflow and I want to be memory efficient. Any help would be appreciated.

Basic linked list implementation Sep 21, 2025
r/C_Programming
last yr.
Create and copy a linked list complexity. Oct 3, 2022
r/learnprogramming
4y ago
How do you ACTUALLY implement Linked List? Oct 23, 2022
r/computerscience
3y ago
More results from reddit.com
🌐
Stack Overflow
stackoverflow.com › questions › 37089414 › how-to-deep-copy-this-linked-list
c - How to deep Copy this linked list - Stack Overflow
May 7, 2016 - Copy struct node_t { int priority,moves; int** data; // 2D matrix of integers struct node_t *prev_board; }; This is what I have so far. This methods takes in the source list and returns a deep copy list.
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › shallow and deep copy
r/learnpython on Reddit: Shallow and Deep Copy
May 18, 2020 -

I am fairly new to the Python realm. What is the difference between shallow and deep copy? I know the theoritical part of it but Im not actually able to understand while practicing it.

1)Does the list.copy() work on shallow copy technique? How does it work?

2)How does it differ from the other copying techniques like the = operator; slicing [:] ; list() constructor?

I have experimented it on the interactive python using two lists list1 and list2. When using "List2 = List1", I was able to see changes I made to the List2 on the List1. Whereas copying the contents of List1 to the List2 using " List2 = List1.copy()" , didn't do so.

Please enlighten me! Thanks in advance!

🌐
Reddit
reddit.com › r/learnprogramming › [c++] deep copy a linked list?
r/learnprogramming on Reddit: [C++] Deep Copy a Linked List?
March 1, 2016 -

I'm still working on my Data Structure's homework and I'm hung up again, this time on overloading the = operator. I'm almost certain I'm deep copying, though I wouldn't be shocked if someone told me otherwise. The issue rises when I'm trying to clear the linked lists. The first clears fine, but the ones that the first was copied to result in "_CrtlsValidHeapPointer(block)".

Here's my overloaded =operator and clear, any help would be greatly appreciated: (overloaded =operator, is passed a LinkedList)

Node<T>* current = m_head;
	Node<T>* eList = rhs.m_head;
	m_head = new Node<T>(rhs.m_head->m_data,  eList->m_next);
	current = m_head;
	eList = rhs.m_head->m_next;

	while (eList != NULL)
	{
		current->m_next = new Node<T>(eList->m_data,eList->m_next);
		eList = eList->m_next;
		current = current->m_next;
	}
	m_size = rhs.m_size;

(clear function)

Node<T>* ptr = m_head;

while (ptr != NULL)
{
	m_head = ptr->m_next;
	delete[] ptr;
	ptr = m_head;
}
m_head = NULL;
m_size = 0;

edit: I think what I'm doing has something to do with deleting a dangling pointer? If that's the case then my =operator is not implemented correctly, but I'm unsure how else I would do it.

🌐
Rosetta Code
rosettacode.org › wiki › Deepcopy
Deepcopy - Rosetta Code
2 weeks ago - Immutable types like numbers, strings, and csets will show as the same (i.e. ===) and different mutable types will show as not the same (i.e. ~===). This clearly shows the difference between assignment, copy, and deepcopy. Analysis of copy depth for knota (assignment) vs. knot: list_11(7) === list_11(7) 9 === 9 8 === 8 7 === 7 record rec1_2(3) === record rec1_2(3) set_2(1) === set_2(1) table_2(2) === table_2(2) record Class1__state_2(4) === record Class1__state_2(4) Analysis of copy depth for knotc (copy) vs.
🌐
GeeksforGeeks
geeksforgeeks.org › c++ › shallow-copy-and-deep-copy-in-c
Shallow Copy and Deep Copy in C++ - GeeksforGeeks
January 17, 2026 - #include <iostream> using namespace ... changes obj1.x. In deep copy, a new object is created by copying all variable values and allocating separate memory for dynamically allocated variables....
🌐
Cplusplus
cplusplus.com › forum › general › 68198
[simple] Deep copy of a linked list - C++ Forum
Can someone figure out what is wrong? ... The problem with deepCopy is that it points the next pointer of the new nodes to the nodes in the old list. ... the line: new listrec (*copy) creates an exact copy of the copy argument, however, the ->next member of this copy is still the same as the original copy member's ->next, so we need to iterate through all the items in the linked list creating copies, which is what we are doing with the:
🌐
Medium
medium.com › spotthedifference › deep-copy-a-linked-list-b90d8376223f
Deep Copy a Linked List
July 18, 2020 - Thus, a reference to F’ is returned to its previous call. This continues until all the nodes are linked and we reach the head. A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list.
🌐
Nullprogram
nullprogram.com › blog › 2024 › 07 › 31
Deep list copy: More than meets the eye
I recently came across a take-home C programming test which had more depth and complexity than I suspect the interviewer intended. While considering it, I also came up with a novel, or at least unconventional, solution. The problem is to deep copy a linked list where each node references a random list element in addition to usual linkage — similar to LeetCode problem 138.
🌐
Medium
medium.com › @stolzmo › understanding-shallow-and-deep-copies-in-python-36b53729c5a4
Understanding Shallow and Deep Copies in Python | by Mohamed Elaraby | Medium
June 28, 2024 - A deep copy creates a recursive copying process of the original collection object, so it populates copies of the child objects found in the original. That means that the new collection object and its elements are independent of the original.
🌐
Cplusplus
cplusplus.com › forum › beginner › 187498
Deep copy of a list? - C++ Forum
And here's the function, otherList ... make a deep copy of: ... Line 12: Problem here is you now have two lists pointing to the the same BookListNode. You're going to have a problem, when you try to delete a node from your BookList. Deleting an entry from a BookList should delete the associated BookListNode. Once you do that, the other BookList is going to point to a BookListNode that no longer exists. You should either use smart pointers, or create a copy of ...
🌐
Code Maze
code-maze.com › home › how to copy or clone a list in c#
How to Copy or Clone a List in C# - Code Maze
2 weeks ago - That second case is the one worth the reading time. Getting a list whose objects are also copies is called a deep copy, and C# has no single method for it, because what “a copy” means depends on the type in the list.
🌐
Youcademy
youcademy.org › copying-arrays-assign-list-to-another-list-c
Copying Arrays in C: How to Assign One List to Another List | Youcademy
While strcpy() is convenient for string copying, it’s generally recommended to use strncpy() or other safer alternatives to prevent buffer overflow issues. The assignment operator (=) in C can be used to create a shallow copy of an array.
🌐
TutorialsPoint
tutorialspoint.com › copy-list-with-random-pointer-in-cplusplus
Copy list with random Pointer in C++
To achieve the copy of the linked list with the data and random pointer, we will first append the new node with the same value after each node. This will create a duplicate node after each node.