#include using namespace std; template class Node{ public: T data; Node* next; Node(T data, Node* next) : data(data), next(next){} }; template class LinkedList{ Node* head; public: LinkedList(T data){ head = new Node(data, nullptr); } bool insertAtPosition(int position, T data){ Node* newNode = new Node(data, head); if(position == 0){ head = newNode; } else{ for(int i=0;inext; } Node* temp = newNode->next; newNode = newNode->next; temp->next = newNode; } return true; } void printList(){ Node* temp = head; while(temp != nullptr){ cout<data; temp = temp->next; } } }; int main(){ LinkedList list(1); list.insertAtPosition(0, 1); list.insertAtPosition(1, 3); list.printList(); return 0; }