Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More optimized #307

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

More optimized #307

wants to merge 4 commits into from

Conversation

Anshuman7080
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant