From 0cbc2a80987c1b6e1b2010dfe965c0d9a6951a03 Mon Sep 17 00:00:00 2001 From: HemanthKumar8251 <85030810+HemanthKumar8251@users.noreply.github.com> Date: Wed, 6 Oct 2021 18:55:51 +0530 Subject: [PATCH 1/7] Create StacksUsingLL.cpp --- C++/Program_26/StacksUsingLL.cpp | 73 ++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 C++/Program_26/StacksUsingLL.cpp diff --git a/C++/Program_26/StacksUsingLL.cpp b/C++/Program_26/StacksUsingLL.cpp new file mode 100644 index 00000000..219da729 --- /dev/null +++ b/C++/Program_26/StacksUsingLL.cpp @@ -0,0 +1,73 @@ +//Stacks Using Linked_Lists +#include +using namespace std; +class node{ + public: + int data; + node *link; +}*top=NULL; + +void push(int x){ + node *t; + t = new node; + if(t==NULL){ + cout<<"Stack is full[Satck overflow]"<data = x; + t->link = top; + top = t; + } +} + +void display(node *p){ + while(p){ + cout<data<<" "; + p = p->link; + } + cout<link; + x = p->data; + delete p; + } + return x; + +} + +int main(){ + + int x; + char c; + while(1){ + cout<<"Choose an Operation : \n1.Push\n2.Pop\n3.Display\n4.Exit"<>c; + switch (c) + { + case '1': + cout<<"Enter the element : "; + cin>>x; + push(x); + break; + case '2': + x=pop(); + cout<<"Poped element is "< Date: Wed, 6 Oct 2021 18:56:27 +0530 Subject: [PATCH 2/7] Add files via upload --- C++/Program_26/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 C++/Program_26/README.md diff --git a/C++/Program_26/README.md b/C++/Program_26/README.md new file mode 100644 index 00000000..ab77102f --- /dev/null +++ b/C++/Program_26/README.md @@ -0,0 +1 @@ +Program to implement Stack DataStructure Using Linked Lists \ No newline at end of file From 481777a499e9b85de5d206971f601978437ca1c9 Mon Sep 17 00:00:00 2001 From: HemanthKumar8251 <85030810+HemanthKumar8251@users.noreply.github.com> Date: Wed, 6 Oct 2021 18:57:13 +0530 Subject: [PATCH 3/7] Update README.md --- C++/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/C++/README.md b/C++/README.md index de6ed221..83c0b67b 100644 --- a/C++/README.md +++ b/C++/README.md @@ -15,3 +15,5 @@ | 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 +| Program-26 | Program to Implement Stack Data Structure Using Linked Lists + From 77458dd412bc25f7ef1207aa4011d0240ee08bb5 Mon Sep 17 00:00:00 2001 From: HemanthKumar8251 <85030810+HemanthKumar8251@users.noreply.github.com> Date: Wed, 6 Oct 2021 19:08:33 +0530 Subject: [PATCH 4/7] Update README.md --- C++/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/C++/README.md b/C++/README.md index 83c0b67b..55222d8c 100644 --- a/C++/README.md +++ b/C++/README.md @@ -16,4 +16,6 @@ | Program-24 | Program to convert Hexa-Decimal number to Decimal number | Program-25 | Program to Implement Queue Data Structure Using Linked Lists | Program-26 | Program to Implement Stack Data Structure Using Linked Lists +| Program-27 | Program to Evaluate Polynomials Using Linked Lists + From 5103a4d2cfe842c77e4034890706f4ab183c3beb Mon Sep 17 00:00:00 2001 From: HemanthKumar8251 <85030810+HemanthKumar8251@users.noreply.github.com> Date: Wed, 6 Oct 2021 19:10:08 +0530 Subject: [PATCH 5/7] Update README.md --- C++/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C++/README.md b/C++/README.md index 55222d8c..6ebe22e2 100644 --- a/C++/README.md +++ b/C++/README.md @@ -16,6 +16,6 @@ | Program-24 | Program to convert Hexa-Decimal number to Decimal number | Program-25 | Program to Implement Queue Data Structure Using Linked Lists | Program-26 | Program to Implement Stack Data Structure Using Linked Lists -| Program-27 | Program to Evaluate Polynomials Using Linked Lists +| Program-27 | Program to Evaluate Polynomial expression Using Linked Lists From 1a24dc27ed39b8d3ee95f025483d494cee0ca8c7 Mon Sep 17 00:00:00 2001 From: HemanthKumar8251 <85030810+HemanthKumar8251@users.noreply.github.com> Date: Wed, 6 Oct 2021 19:11:46 +0530 Subject: [PATCH 6/7] Create Polynomial_Expression.cpp --- C++/Program_27/Polynomial_Expression.cpp | 50 ++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 C++/Program_27/Polynomial_Expression.cpp diff --git a/C++/Program_27/Polynomial_Expression.cpp b/C++/Program_27/Polynomial_Expression.cpp new file mode 100644 index 00000000..d982ca2b --- /dev/null +++ b/C++/Program_27/Polynomial_Expression.cpp @@ -0,0 +1,50 @@ +//Polynomial Expressions +#include +using namespace std; +class node{ + public: + int c; + int e; + node *link; +}*P=NULL; + +void create(){ + node *last,*t; + int n; + cout<<"Enter the NUmber of Terms : "; + cin>>n; + cout<<"Enter all the Terms in coeffient and exponent form : "<> t->c >> t->e; + t->link = NULL; + if(P==NULL) + last = P = t; + else{ + last->link = t; + last = t; + } + } + +} + +double evalute(int x){ + node *t = P; + double sum = 0.0; + while(t){ + sum += t->c*pow(x,t->e); + t = t->link; + } + return sum; +} + +int main(){ + int n; + create(); + cout<<"Enter the Value of x : "; + cin>>n; + double r = evalute(n); + cout<<"The value of the polynomial expression when x = "< Date: Wed, 6 Oct 2021 19:12:02 +0530 Subject: [PATCH 7/7] Add files via upload --- C++/Program_27/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 C++/Program_27/README.md diff --git a/C++/Program_27/README.md b/C++/Program_27/README.md new file mode 100644 index 00000000..d0d7e7a6 --- /dev/null +++ b/C++/Program_27/README.md @@ -0,0 +1 @@ +Program to evaluate polynomial expression Using Linked Lists \ No newline at end of file