Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ void CLL::push(char data) { // You write - if the size is 0, add a first nod

ID: 3708324 • Letter: C

Question

C++

void CLL::push(char data) { // You write - if the size is 0, add a first node in the linked list
// by calling addFirst. Otherwise add a new node to the end of the linked list. Note that this
// linked list is circular, so you must make the last node's next pointer point to the first node.
}
void CLL::addFirst(char data) {
// you write - add the very first node to the linked list
}
void CLL::addAtFront(char data) {
// you write - if the size of the linked list is 0, add a first node by calling addFirst.
//Otherwise add a new node to the beginning of the list
//Since this linked list is circular, you must make the last node now point to this new node
//you just added to the front of the linked list
}

Explanation / Answer

here is code : ---------->>>>>>>>

void CLL::push(char data) { // You write - if the size is 0, add a first node in the linked list
// by calling addFirst. Otherwise add a new node to the end of the linked list. Note that this
// linked list is circular, so you must make the last node's next pointer point to the first node.
if(size == 0){
addfirst(data);
return;
}
Node *temp = new Node;
temp->data = data;
temp->next = head;
Node *tt = head->next;
while(tt.next != head){
tt = tt->next;
}
tt->next = temp;
size++
}
void CLL::addFirst(char data) {
// you write - add the very first node to the linked list
Node *temp = new Node;
temp->data = data;
head = temp;
temp->next = head;
size++;
}
void CLL::addAtFront(char data) {
// you write - if the size of the linked list is 0, add a first node by calling addFirst.
//Otherwise add a new node to the beginning of the list
//Since this linked list is circular, you must make the last node now point to this new node
//you just added to the front of the linked list
Node *temp = new Node;
temp->data = data;
temp->next = head;
Node *tt = head->next;
while(tt->next != head){
tt = tt->next;
}
tt->next = temp;
head = temp;
size++;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote