Write a class in C++ to delete the Nth node of the linked list, and write it with a smart pointer

#include class Node { public: int data; std::shared_ptr next; }; class LinkedList { public: LinkedList() { head = nullptr; } void deleteNode(int n) { std::shared_ptr temp = head, prev; if (n == 1) { head

Guess you like

Origin blog.csdn.net/weixin_35748962/article/details/129563788