Hacktoberfest-2021
Hacktoberfest-2021 copied to clipboard
More optimized
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.