linked list;
calteen
Posted on June 8, 2023
class Node {
public:
int data;
Node* next;
Node(int data){
this ->data = data;
this -> next = NULL;
}
};
void InsertAtHead(Node* &head, int d){
//new node create
Node* temp = new Node (d);
temp -> next = head;
head = temp;
}
void InsertAtTail(Node* &tail, int d){
Node*temp = new Node (d);
tail ->next = temp;
tail = temp;
}
void print(Node* &head){
Node* temp = head;
while(temp != NULL){
cout <<temp ->data;
temp = temp ->next;
}
}
int main() {
cout << "Hello world!";
Node* node1 = new Node(10);
cout<< node1 ->data << endl;
cout << node1 -> next <<endl;
return 0;
}
💖 💪 🙅 🚩
calteen
Posted on June 8, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.