From e11d4ed76ae4fa9b73c54932195c6ecde1f0a135 Mon Sep 17 00:00:00 2001 From: HemanthKumar8251 <85030810+HemanthKumar8251@users.noreply.github.com> Date: Tue, 5 Oct 2021 22:33:12 +0530 Subject: [PATCH 1/3] Create Queues_Using_Linked_Lists.cpp --- C++/Program_25/Queues_Using_Linked_Lists.cpp | 82 ++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 C++/Program_25/Queues_Using_Linked_Lists.cpp diff --git a/C++/Program_25/Queues_Using_Linked_Lists.cpp b/C++/Program_25/Queues_Using_Linked_Lists.cpp new file mode 100644 index 00000000..65cbca63 --- /dev/null +++ b/C++/Program_25/Queues_Using_Linked_Lists.cpp @@ -0,0 +1,82 @@ +//Queues Using Linked List +#include +using namespace std; + +class node{ + public: + int data; + node *link; +}*front=NULL,*rear=NULL; + +void enqueue(int x){ + node *t; + t = new node; + if(t==NULL) + cout<<"Queue is Full"<data = x; + t->link = NULL; + } + if(front==NULL){ + front = rear = t; + } + else{ + rear->link=t; + rear = t; + } +} + +int dequeue(){ + node *p; + int x = -1; + if(front==NULL) + cout<<"Queue is Empty!"<link; + x = p->data; + delete p; + } + return x; +} + +void display(){ + node *p=front; + while(p){ + cout<data<<" "; + p = p->link; + } + cout<>c; + switch (c) + { + case '1': + cout<<"Enter the element : "; + cin>>x; + enqueue(x); + break; + case '2': + x=dequeue(); + if(x!=-1) + cout<<"Deleted element is "< Date: Tue, 5 Oct 2021 22:34:12 +0530 Subject: [PATCH 2/3] Add files via upload --- C++/Program_25/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 C++/Program_25/README.md diff --git a/C++/Program_25/README.md b/C++/Program_25/README.md new file mode 100644 index 00000000..9f24ccab --- /dev/null +++ b/C++/Program_25/README.md @@ -0,0 +1 @@ +Program to implement Queue DataStructure Using Linked Lists \ No newline at end of file From bda98c5245f6162ac98cddfa4a8dbc7a0a0b7bf8 Mon Sep 17 00:00:00 2001 From: HemanthKumar8251 <85030810+HemanthKumar8251@users.noreply.github.com> Date: Tue, 5 Oct 2021 22:49:44 +0530 Subject: [PATCH 3/3] Update README.md --- C++/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/C++/README.md b/C++/README.md index 922575d5..de6ed221 100644 --- a/C++/README.md +++ b/C++/README.md @@ -14,3 +14,4 @@ | Program-15 | Program to find modular exponentiation. | Program-19| To check whether a number is in palindrome or not | Program-24 | Program to convert Hexa-Decimal number to Decimal number +| Program-25 | Program to Implement Queue Data Structure Using Linked Lists