Posts

Showing posts from April 12, 2018

Data Structure Lab 7

Image
Source Code: #include <iostream> using namespace std; struct Node{ int id; Node*next; // Node*head = NULL; }; Node* head = NULL; Node* temp=NULL; //menu void menu() { cout << "***************************************** \n"; cout << "1: Insert an Element at front \n"; cout << "2: delete an Elemnet from end \n"; cout << "3: Search an element \n"; cout << "4: Display list \n"; cout << "5: Is List empty \n"; cout << "6: Exit \n "; cout << "***************************************** \n"; cout<< " Enter Your  choice: "; } //insert at start void InsertAtStart(int x) { Node*newnode = new Node; newnode->id = x; newnode->next = NULL; if (head == NULL) { head = newnode; cout<<"Value is entered in linked list \n "; } else ...

DS Lab quiz 1

There are n cars at a gas station .Every time a new car arrive it joins the line from the end.the car came from first served fist.implement a linked list based solution in order to record the information.Store the following properties of car in your linked list. Car plate No Car Model Car's position in the line your solution must be contain following functions. Add the information of a car. update car info display the total size. Source Code: #include <iostream> using namespace std; struct car{ string CplateNo; int model; int carposition; car*next; };car *head=NULL; car* temp=NULL; string cno; int mod,cp=0,sizecount=0; //add void add(string Carno,int carmod) { bool flag=false; car* c=new car; c->carposition=cp++; c->CplateNo=Carno; c->model =carmod; c->next=NULL; if(head==NULL) { sizecount++; head=c; cout<<"Information is entered"<<endl; ...