21BCA1946 Worksheet1.3
21BCA1946 Worksheet1.3
21BCA1946 Worksheet1.3
2. Task to be done: Creating a linked list and inserting an element on the front of it.
class Node{
public:
int data;
Node * next;
};
(*prev_head) = new_head;
}
void printList(Node* a)
{
while (a != NULL)
{
cout << a->data << " ";
a = a->next;
}
}
Node* list[n];
Node** tail;
Node** head;
head = &(list[0]);
if (i != (n-1))
{
list[i]->next = list[i+1];
}
else if(i == (n-1))
{
list[i]->next = NULL;
tail = &(list[i]);
}
}
int new_head_value;
cout << endl << "Enter the element to insert at beginning: ";
cin >> new_head_value;
insertStart(head, new_head_value);
5. Result/Output/Writing Summary:
Worksheet Rubrics:
Understanding of Experiment 10% of total grade that is 2 marks
Command Description for all concepts covered in experiment 30% of total grade that is 6marks