Skip to content

Conversation

BhumikaMeghani
Copy link

Singly Linked List in C++ (Menu-Driven)

This program implements a singly linked list in C++ using a class-based approach.
It provides operations for insertion, deletion, display, and counting of nodes.
The program is menu-driven, allowing users to interactively perform operations.

Class: linkedlist

  • Maintains a pointer start to the head node.
  • Constructor: Initializes an empty list.
  • addatbeg(int num): Insert at beginning.
  • append(int num): Insert at end.
  • addatloc(int loc, int num): Insert at a specific location.
  • del(int num): Delete a node by value.
  • display(): Print all nodes.
  • count(): Return total number of nodes.
  • Destructor: Frees allocated memory.

Menu Options

  1. Add at beginning
  2. Append at end
  3. Add at a specific location
  4. Delete a node
  5. Display the list
  6. Count nodes
  7. Exit

This PR adds a complete implementation of singly linked list with a menu-driven interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant