Assignment # 04 Linked List
Assignment # 04 Linked List
a.) Implement the singly linked list and handle the following.
- Insertion (at start, at specific location & at end)
- Deletion (at start, at specific location & at end)
- Displaying a singly linked list
b.) Implement the Circular linked list and handle the following.
- Insertion (at start, at specific location & at end)
- Deletion (at start, at specific location & at end)
- Displaying a singly linked list
c.) Implement the Circular linked list and handle the following.
- Insertion (at start, at specific location & at end)
- Deletion (at start, at specific location & at end)
- Displaying a singly linked list
Below I am providing you the code for singly link list. You have to do
like the following code.
#include <iostream>
// Define the structure for a node
struct Node {
int data; // Data stored in the node
Node* next; // Pointer to the next node in the list
};
/*setting the next pointer of the new node to point to the current head,
assuming that the head pointer is pointing to the first node of the linked
list (or nullptr if the list is empty).*/
int main() {
Node* head = nullptr;
return 0;
}