Sahaj.blogs

Day page

26 Jan 2024

Study

C++ · DSA: linked list

A singly linked list built with unique_ptr nodes: push_front, traversal, in-place reversal, and how it compares with vector.

  • A linked list gives O(1) insertion at the front but O(n) access by index.
  • Using unique_ptr for next pointers makes the list free itself with no manual delete.

Read the post →