Hacktoberfest-2021 icon indicating copy to clipboard operation
Hacktoberfest-2021 copied to clipboard

More optimized

Open Anshuman7080 opened this issue 4 months ago • 0 comments

Memory Management: Using std::unique_ptr eliminates the need for manual memory management (malloc and free). This reduces the chances of memory leaks and dangling pointers.

Encapsulation: Encapsulated the linked list logic in a LinkedList class, which makes the code cleaner and adheres to object-oriented principles.

Modern C++: Utilized make_unique for creating nodes, which is a more modern and safer approach than using malloc. Const-Correctness: The display function is marked as const, indicating that it does not modify the state of the linked list.

Anshuman7080 avatar Oct 04 '24 01:10 Anshuman7080