Please use c++ and also please post codes and output. thanks USE DOUBLE LINKED L
ID: 3842862 • Letter: P
Question
Please use c++ and also please post codes and output. thanks
USE DOUBLE LINKED LIST FOR DISPLAY_BACK AND DISPLAY_FRONT
Task 1:
Let's look to build the basic methods of for our linked list. Look to implement linked list that will create methods for pushing value onto head of the list and return the length of the linked list.
This exercise will span multiple lectures.
Expand Singly Linked List From Assignment and Implement Double Linked List
void DoublyLinkedList() {
struct node* head;
node* tail;
int len;
head = BuildOneTwoThree(); // Start with {1, 2, 3}
Push(&head, 13); // Push 13 on the front, yielding {13, 1, 2, 3}
Push_Tail(14) // Start with {1, 2, 3,14}
Pop_Head //{2,3} Create method to remove first integer
Pop_Tail //{1,2} Create method to remove last integer
Display_Front() // Create a method that will output all values in a doubly
linked Lists from first node to the last node
Display_Back() // Create a method that will output all values in a doubly
linked list from the last node to the first node
len = Length(head); // Computes that the length is 5.
}
(Attached source code and output below)
Explanation / Answer
// Example program
#include <iostream>
using namespace std;
#include <iostream>
using namespace std;
#include<stdio.h>
#include<stdlib.h>