#include <iostream>
#include <list>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
int myints[] = {};
list<int> l, l1 (myints, myints + sizeof(myints) / sizeof(int));
list<int>::iterator it;
int choice, item;
while (1)
{
cout<<"\n---------------------"<<endl;
cout<<"***List Implementation***"<<endl;
cout<<"\n---------------------"<<endl;
cout<<"1.Insert Element at the Front"<<endl;
cout<<"2.Insert Element at the End"<<endl;
cout<<"3.Front Element of List"<<endl;
cout<<"4.Last Element of the List"<<endl;
cout<<"5.Size of the List"<<endl;
cout<<"6.Display Forward List"<<endl;
cout<<"7.Exit"<<endl;
cout<<"Enter your Choice: ";
cin>>choice;
switch(choice)
{
case 1:
cout<<"Enter value to be inserted at the front: ";
cin>>item;
l.push_front(item);
break;
case 2:
cout<<"Enter value to be inserted at the end: ";
cin>>item;
l.push_back(item);
break;
case 3:
cout<<"Front Element of the List: ";
cout<<l.front()<<endl;
break;
case 4:
cout<<"Last Element of the List: ";
cout<<l.back()<<endl;
break;
case 5:
cout<<"Size of the List: "<<l.size()<<endl;
break;
case 6:
cout<<"Elements of the List: ";
for (it = l.begin(); it != l.end(); it++)
cout<<*it<<" ";
cout<<endl;
break;
case 7:
exit(1);
break;
default:
cout<<"Wrong Choice"<<endl;
}
}
return 0;
}
TASK:
Run the above code and display the output of list as your Data of Birth, e.g., if your DOB is 17-02-1994, then output should be:
1 7 0 2 1 9 9 4
Also perform deletion from front and rare of list and attach output.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- public List<String> getLikes(String user) This will take a String representing a user (like “Mike”) and return a unique List containing all of the users that have liked the user “Mike.” public List<String> getLikedBy(String user) This will take a String representing a user (like “Tony”) and return a unique List containing each user that “Tony” has liked. create a Main to test your work. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.ArrayList;import java.util.Arrays;import java.util.HashMap;import java.util.HashSet;import java.util.List;import java.util.Map;import java.util.Set; public class FacebookLikeManager { public List<String> facebookMap; private Set<String> likesSets; public FacebookLikeManager() { facebookMap = new ArrayList<>(); likesSets = new HashSet<>(Arrays.asList("Mike","Kristen","Bill","Sara")); } public void buildMap(String filePath) {…arrow_forwardclass Divisible:def div(minr, maxr, div1, div2):listdiv = []i = minrwhile i<maxr:if i%div1==0 and i%div2==0:listdiv.append(i)i+=1return listdiv if __name__ == "__main__":min = int(input("Enter the min: "))max = int(input("Enter the max: "))div1 = int(input("Enter div1: "))div2 = int(input("Enter div2: "))d1 = Divisible.div(min,max,div1,div2)print(d1) flowchartarrow_forwardC++ PROGRAMMINGTopic: Binary Search Trees Explain the c++ code below.: SEE ATTACHED PHOTO FOR THE PROBLEM INSTRUCTIONS It doesn't have to be long, as long as you explain what the important parts of the code do. (The code is already implemented and correct, only the explanation needed) #include "node.h" #include <iostream> using namespace std; class BTree { node* root; int size; node* create_node(int num, node* parent) { node* n = (node*) malloc( sizeof(node) ); n->element = num; n->parent = parent; n->right = NULL; n->left = NULL; return n; } public: BTree() { root = NULL; size = 0; } node* left(node* p) { return p->left; } node* right(node* p) { return p->right; } node* sibling(node* p){ if(p != root){ node* P = p->parent; if(P->left != NULL && P->right != NULL){…arrow_forward
- language carrow_forward#include <iostream>using namespace std;class st{private:int arr[100];int top;public:st(){top=-1;}void push(int ItEM) {top++;arr[top]=ItEM; }bool ise() {return top<0;} int pop(){int Pop;if (ise()) cout<<"Stack is emptye ";else{Pop=arr[top];top--;return Pop;}}int Top(){int TOP;if (ise()) cout<<" empty ";else {TOP=arr[top];return TOP;}}void screen(){ for (int i = 0; i <top+1 ; ++i) {cout<<arr[i];} }};int main() {st c;c.push(1);c.push(2);c.push(3);c.push(4);c.pop();c.push(5);c.screen();return 0;} alternative to this code??arrow_forwardzain IQ لا توجد خدمة docs.google.com Q #includeusing namespace std; int main (){ int a[100]; int i, n „large ;cout>a[i]; }large =a[0];for (i=O ; i<=99 ; i++)if (larg < a[i])larg = ali] ;cout<<" largest value in the array = "<< larg ;return 0;} true False The general form of (One- Dimensional Arrays) is:Type Array Name [number of elements] * True False Char a[5][6]; *arrow_forward
- Help me fix all the error in this programme #include <iostream>#include <iomanip>#include <ctype.h>#include <string.h> using namespace std; struct nodeBankAccount { char bank_acc_name[30]; string bank_acc_num; double bank_acc_bal; nodeBankAccount*link;}; nodeBankAccount *head, *rear;nodeBankAccount *current;nodeBankAccount *newNode;nodeBankAccount *deleteBank;nodeBankAccount *previous;nodeBankAccount *found; void searchBankAccount(){ char searchName[30]; int searchNumber = 0; int searchOption; char answer; int searchNumber_No = 0; found = NULL; current = head; if(current == NULL) { cout<<"\n\n List is empty!!!\n"; cout<< "Cannot perfom search operation \n\n"; }else{ do { cout << "\n\tSearch record\n"; cout << "\t\tSearch Menu\n"; cout<<"\nEnter 1 to search by Bank Account Name\n: ";…arrow_forward#ifndef LLCP_INT_H#define LLCP_INT_H #include <iostream> struct Node{ int data; Node *link;};void DelOddCopEven(Node*& headPtr);int FindListLength(Node* headPtr);bool IsSortedUp(Node* headPtr);void InsertAsHead(Node*& headPtr, int value);void InsertAsTail(Node*& headPtr, int value);void InsertSortedUp(Node*& headPtr, int value);bool DelFirstTargetNode(Node*& headPtr, int target);bool DelNodeBefore1stMatch(Node*& headPtr, int target);void ShowAll(std::ostream& outs, Node* headPtr);void FindMinMax(Node* headPtr, int& minValue, int& maxValue);double FindAverage(Node* headPtr);void ListClear(Node*& headPtr, int noMsg = 0); // prototype of DelOddCopEven of Assignment 5 Part 1 #endifarrow_forwardint tryMe(int x[], int size); void main() { int list[75]; cout<< tryMe (list, 75); } valid invalidarrow_forward
- 3. int count(10); while(count >= 0) { count -= 2; std::cout << count << endl;arrow_forwardHelp fill in code! #if !defined(PRODUCE_H_INCL)#define PRODUCE_H_INCL#define PRODUCE_NAME 21typedef struct produce {char name[PRODUCE_NAME];int inven;} produce_t;typedef struct list_node {produce_t data;struct list_node *restp;} list_node_t;typedef struct produce_list {/* fill in the code to declare a list_node_t pointer called head */int size;} produce_list_t;void read_produce_file (char filename[], produce_list_t *p);void print_produce (produce_t prod);void print_produce_list (produce_list_t p);void write_produce_file (char filename[], produce_list_t p);list_node_t * search_produce_list (produce_list_t p, char name[]);int update_produce_list (produce_list_t *p, produce_t prod);void print_produce_linked_list (produce_list_t p);#endifarrow_forwardC++ Binary Search Tree program Create a class "Person" with three member variables string first name, string last name, int age. The primary key will be the last name. User will be prompted with a menu with two options: 1, "Enter person", where they will enter the persons first name, last name and age, or 2, "View person list" where the person may view the information previously added.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education