later we create a specialstack class ,which inherits from stack cl.pdf

//later we create a specialstack class ,which inherits from stack class.there we return the smallest integer //implementation #include #include using namespace std; /* A simple stack class named IntStack with push and pop operations */ class IntStack { private: static const int max = 100; int arr[max]; int top; public: //constructor for initialising value of top IntStack() { top = -1; } void push(int x); int pop(); bool isEmpty(); bool isFull(); }; /* Stack\'s member method to check if the stack is iempty */ bool IntStack::isEmpty() { if(top == -1) return true; return false; } /* Stack\'s member method to check if the stack is full */ bool IntStack::isFull() { if(top == max - 1) return true; return false; } /* Stack\'s member method push() to insert an element */ void IntStack::push(int x) { if(isFull()) { cout<<\"Stack Overflow\"; } top++; arr[top] = x; } /* Stack\'s member method pop() to remove an element from it */ int IntStack::pop() { if(isEmpty()) { cout<<\"Stack Underflow\"; abort(); } int x = arr[top]; top--; return x; } /* A class that supports all the stack operations and one additional operation getMIN() that returns the minimum element from stack at any time. This class inherits from the stack class and uses an auxiliarry stack that holds minimum elements */ class SpecialStack: public IntStack { IntStack min; public: //function declarations void push(int x); int pop(); int getMIN(); }; /* SpecialStack\'s member method to insert an element to it. This method makes sure that the min stack is also updated with appropriate minimum values */ void SpecialStack::push(int x) { if(isEmpty()==true) { IntStack::push(x); min.push(x); } else { IntStack::push(x); int y = min.pop(); min.push(y); /* push only when the incoming element of main stack is smaller than or equal to top of auxiliary stack */ if( x <= y ) min.push(x); } } /* SpecialStack\'s member method to remove an element from it. This method removes top element from min stack also. */ int SpecialStack::pop() { int x = IntStack::pop(); int y = min.pop(); /* Push the popped element y back only if it is not equal to x */ if ( y != x ) min.push(y); return x; } /* SpecialStack\'s member method to get minimum element from it. */ int SpecialStack::getMIN() { int x = min.pop(); min.push(x); return x; } /* main program to test SpecialStack methods */ //execution starts here int main() { SpecialStack s; //push 3 elements and get the minimum s.push(15); s.push(25); s.push(33); cout< #include using namespace std; /* A simple stack class named IntStack with push and pop operations */ class IntStack { private: static const int max = 100; int arr[max]; int top; public: //constructor for initialising value of top IntStack() { top = -1; } void push(int x); int pop(); bool isEmpty(); bool isFull(); }; /* Stack\'s member method to check if the stack is iempty */ bool IntStack::isEmpty() { if(top == -1) return true; return false; } /* Stack\'s member method to check if the stack is full */ bool IntStac.

//later we create a specialstack class ,which inherits from stack class.there we return the smallest
integer
//implementation
#include
#include
using namespace std;
/* A simple stack class named IntStack with push and pop operations */
class IntStack
{
private:
static const int max = 100;
int arr[max];
int top;
public:
//constructor for initialising value of top
IntStack()
{
top = -1;
}
void push(int x);
int pop();
bool isEmpty();
bool isFull();
};
/* Stack's member method to check if the stack is iempty */
bool IntStack::isEmpty()
{
if(top == -1)
return true;
return false;
}
/* Stack's member method to check if the stack is full */
bool IntStack::isFull()
{
if(top == max - 1)
return true;
return false;
}
/* Stack's member method push() to insert an element */
void IntStack::push(int x)
{
if(isFull())
{
cout<<"Stack Overflow";
}
top++;
arr[top] = x;
}
/* Stack's member method pop() to remove an element from it */
int IntStack::pop()
{
if(isEmpty())
{
cout<<"Stack Underflow";
abort();
}
int x = arr[top];
top--;
return x;
}
/* A class that supports all the stack operations and one additional operation getMIN() that
returns the minimum element from stack at any time. This class inherits from the stack class and
uses an auxiliarry stack that holds minimum elements */
class SpecialStack: public IntStack
{
IntStack min;
public:
//function declarations
void push(int x);
int pop();
int getMIN();
};
/* SpecialStack's member method to insert an element to it. This method
makes sure that the min stack is also updated with appropriate minimum
values */
void SpecialStack::push(int x)
{
if(isEmpty()==true)
{
IntStack::push(x);
min.push(x);
}
else
{
IntStack::push(x);
int y = min.pop();
min.push(y);
/* push only when the incoming element of main stack is smaller
than or equal to top of auxiliary stack */
if( x <= y )
min.push(x);
}
}
/* SpecialStack's member method to remove an element from it. This method
removes top element from min stack also. */
int SpecialStack::pop()
{
int x = IntStack::pop();
int y = min.pop();
/* Push the popped element y back only if it is not equal to x */
if ( y != x )
min.push(y);
return x;
}
/* SpecialStack's member method to get minimum element from it. */
int SpecialStack::getMIN()
{
int x = min.pop();
min.push(x);
return x;
}
/* main program to test SpecialStack methods */
//execution starts here
int main()
{
SpecialStack s;
//push 3 elements and get the minimum
s.push(15);
s.push(25);
s.push(33);
cout<
#include
using namespace std;
/* A simple stack class named IntStack with push and pop operations */
class IntStack
{
private:
static const int max = 100;
int arr[max];
int top;
public:
//constructor for initialising value of top
IntStack()
{
top = -1;
}
void push(int x);
int pop();
bool isEmpty();
bool isFull();
};
/* Stack's member method to check if the stack is iempty */
bool IntStack::isEmpty()
{
if(top == -1)
return true;
return false;
}
/* Stack's member method to check if the stack is full */
bool IntStack::isFull()
{
if(top == max - 1)
return true;
return false;
}
/* Stack's member method push() to insert an element */
void IntStack::push(int x)
{
if(isFull())
{
cout<<"Stack Overflow";
}
top++;
arr[top] = x;
}
/* Stack's member method pop() to remove an element from it */
int IntStack::pop()
{
if(isEmpty())
{
cout<<"Stack Underflow";
abort();
}
int x = arr[top];
top--;
return x;
}
/* A class that supports all the stack operations and one additional operation getMIN() that
returns the minimum element from stack at any time. This class inherits from the stack class and
uses an auxiliarry stack that holds minimum elements */
class SpecialStack: public IntStack
{
IntStack min;
public:
//function declarations
void push(int x);
int pop();
int getMIN();
};
/* SpecialStack's member method to insert an element to it. This method
makes sure that the min stack is also updated with appropriate minimum
values */
void SpecialStack::push(int x)
{
if(isEmpty()==true)
{
IntStack::push(x);
min.push(x);
}
else
{
IntStack::push(x);
int y = min.pop();
min.push(y);
/* push only when the incoming element of main stack is smaller
than or equal to top of auxiliary stack */
if( x <= y )
min.push(x);
}
}
/* SpecialStack's member method to remove an element from it. This method
removes top element from min stack also. */
int SpecialStack::pop()
{
int x = IntStack::pop();
int y = min.pop();
/* Push the popped element y back only if it is not equal to x */
if ( y != x )
min.push(y);
return x;
}
/* SpecialStack's member method to get minimum element from it. */
int SpecialStack::getMIN()
{
int x = min.pop();
min.push(x);
return x;
}
/* main program to test SpecialStack methods */
//execution starts here
int main()
{
SpecialStack s;
//push 3 elements and get the minimum
s.push(15);
s.push(25);
s.push(33);
cout<
Solution
//later we create a specialstack class ,which inherits from stack class.there we return the smallest
integer
//implementation
#include
#include
using namespace std;
/* A simple stack class named IntStack with push and pop operations */
class IntStack
{
private:
static const int max = 100;
int arr[max];
int top;
public:
//constructor for initialising value of top
IntStack()
{
top = -1;
}
void push(int x);
int pop();
bool isEmpty();
bool isFull();
};
/* Stack's member method to check if the stack is iempty */
bool IntStack::isEmpty()
{
if(top == -1)
return true;
return false;
}
/* Stack's member method to check if the stack is full */
bool IntStack::isFull()
{
if(top == max - 1)
return true;
return false;
}
/* Stack's member method push() to insert an element */
void IntStack::push(int x)
{
if(isFull())
{
cout<<"Stack Overflow";
}
top++;
arr[top] = x;
}
/* Stack's member method pop() to remove an element from it */
int IntStack::pop()
{
if(isEmpty())
{
cout<<"Stack Underflow";
abort();
}
int x = arr[top];
top--;
return x;
}
/* A class that supports all the stack operations and one additional operation getMIN() that
returns the minimum element from stack at any time. This class inherits from the stack class and
uses an auxiliarry stack that holds minimum elements */
class SpecialStack: public IntStack
{
IntStack min;
public:
//function declarations
void push(int x);
int pop();
int getMIN();
};
/* SpecialStack's member method to insert an element to it. This method
makes sure that the min stack is also updated with appropriate minimum
values */
void SpecialStack::push(int x)
{
if(isEmpty()==true)
{
IntStack::push(x);
min.push(x);
}
else
{
IntStack::push(x);
int y = min.pop();
min.push(y);
/* push only when the incoming element of main stack is smaller
than or equal to top of auxiliary stack */
if( x <= y )
min.push(x);
}
}
/* SpecialStack's member method to remove an element from it. This method
removes top element from min stack also. */
int SpecialStack::pop()
{
int x = IntStack::pop();
int y = min.pop();
/* Push the popped element y back only if it is not equal to x */
if ( y != x )
min.push(y);
return x;
}
/* SpecialStack's member method to get minimum element from it. */
int SpecialStack::getMIN()
{
int x = min.pop();
min.push(x);
return x;
}
/* main program to test SpecialStack methods */
//execution starts here
int main()
{
SpecialStack s;
//push 3 elements and get the minimum
s.push(15);
s.push(25);
s.push(33);
cout<
#include
using namespace std;
/* A simple stack class named IntStack with push and pop operations */
class IntStack
{
private:
static const int max = 100;
int arr[max];
int top;
public:
//constructor for initialising value of top
IntStack()
{
top = -1;
}
void push(int x);
int pop();
bool isEmpty();
bool isFull();
};
/* Stack's member method to check if the stack is iempty */
bool IntStack::isEmpty()
{
if(top == -1)
return true;
return false;
}
/* Stack's member method to check if the stack is full */
bool IntStack::isFull()
{
if(top == max - 1)
return true;
return false;
}
/* Stack's member method push() to insert an element */
void IntStack::push(int x)
{
if(isFull())
{
cout<<"Stack Overflow";
}
top++;
arr[top] = x;
}
/* Stack's member method pop() to remove an element from it */
int IntStack::pop()
{
if(isEmpty())
{
cout<<"Stack Underflow";
abort();
}
int x = arr[top];
top--;
return x;
}
/* A class that supports all the stack operations and one additional operation getMIN() that
returns the minimum element from stack at any time. This class inherits from the stack class and
uses an auxiliarry stack that holds minimum elements */
class SpecialStack: public IntStack
{
IntStack min;
public:
//function declarations
void push(int x);
int pop();
int getMIN();
};
/* SpecialStack's member method to insert an element to it. This method
makes sure that the min stack is also updated with appropriate minimum
values */
void SpecialStack::push(int x)
{
if(isEmpty()==true)
{
IntStack::push(x);
min.push(x);
}
else
{
IntStack::push(x);
int y = min.pop();
min.push(y);
/* push only when the incoming element of main stack is smaller
than or equal to top of auxiliary stack */
if( x <= y )
min.push(x);
}
}
/* SpecialStack's member method to remove an element from it. This method
removes top element from min stack also. */
int SpecialStack::pop()
{
int x = IntStack::pop();
int y = min.pop();
/* Push the popped element y back only if it is not equal to x */
if ( y != x )
min.push(y);
return x;
}
/* SpecialStack's member method to get minimum element from it. */
int SpecialStack::getMIN()
{
int x = min.pop();
min.push(x);
return x;
}
/* main program to test SpecialStack methods */
//execution starts here
int main()
{
SpecialStack s;
//push 3 elements and get the minimum
s.push(15);
s.push(25);
s.push(33);
cout<

Recomendados

New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx por
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxcurwenmichaela
3 visualizações206 slides
Given the following ADT definition of a stack to use stack .docx por
Given the following ADT definition of a stack to use stack .docxGiven the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docxshericehewat
4 visualizações38 slides
@author Derek Harter @cwid 123 45 678 @class .docx por
@author Derek Harter  @cwid   123 45 678  @class  .docx@author Derek Harter  @cwid   123 45 678  @class  .docx
@author Derek Harter @cwid 123 45 678 @class .docxadkinspaige22
2 visualizações40 slides
Posfix por
PosfixPosfix
PosfixFajar Baskoro
536 visualizações7 slides
Stacks and queue por
Stacks and queueStacks and queue
Stacks and queueAmit Vats
946 visualizações76 slides
(674335607) cs2309 java-lab-manual por
(674335607) cs2309 java-lab-manual(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manualChandrapriya Jayabal
252 visualizações45 slides

Mais conteúdo relacionado

Similar a later we create a specialstack class ,which inherits from stack cl.pdf

StackInterface An interface for the ADT stack. Do not modif.pdf por
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfARCHANASTOREKOTA
2 visualizações27 slides
Need help with writing the test cases for the following code in java-.docx por
Need help with writing the test cases for the following code in java-.docxNeed help with writing the test cases for the following code in java-.docx
Need help with writing the test cases for the following code in java-.docxLucasmHKChapmant
2 visualizações9 slides
#includeiostream#includestdlib.husing namespace std;class .pdf por
#includeiostream#includestdlib.husing namespace std;class .pdf#includeiostream#includestdlib.husing namespace std;class .pdf
#includeiostream#includestdlib.husing namespace std;class .pdfasif1401
4 visualizações11 slides
For the following codeAdd a poll() method that returns the intege.pdf por
For the following codeAdd a poll() method that returns the intege.pdfFor the following codeAdd a poll() method that returns the intege.pdf
For the following codeAdd a poll() method that returns the intege.pdfmampbellzumberge517
2 visualizações5 slides
Stack queue por
Stack queueStack queue
Stack queueFraboni Ec
295 visualizações50 slides
Stack queue por
Stack queueStack queue
Stack queueJames Wong
125 visualizações50 slides

Similar a later we create a specialstack class ,which inherits from stack cl.pdf(20)

StackInterface An interface for the ADT stack. Do not modif.pdf por ARCHANASTOREKOTA
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdf
ARCHANASTOREKOTA2 visualizações
Need help with writing the test cases for the following code in java-.docx por LucasmHKChapmant
Need help with writing the test cases for the following code in java-.docxNeed help with writing the test cases for the following code in java-.docx
Need help with writing the test cases for the following code in java-.docx
LucasmHKChapmant2 visualizações
#includeiostream#includestdlib.husing namespace std;class .pdf por asif1401
#includeiostream#includestdlib.husing namespace std;class .pdf#includeiostream#includestdlib.husing namespace std;class .pdf
#includeiostream#includestdlib.husing namespace std;class .pdf
asif14014 visualizações
For the following codeAdd a poll() method that returns the intege.pdf por mampbellzumberge517
For the following codeAdd a poll() method that returns the intege.pdfFor the following codeAdd a poll() method that returns the intege.pdf
For the following codeAdd a poll() method that returns the intege.pdf
mampbellzumberge5172 visualizações
Stack queue por Fraboni Ec
Stack queueStack queue
Stack queue
Fraboni Ec295 visualizações
Stack queue por James Wong
Stack queueStack queue
Stack queue
James Wong125 visualizações
Stack queue por Young Alista
Stack queueStack queue
Stack queue
Young Alista111 visualizações
Stack queue por Luis Goldster
Stack queueStack queue
Stack queue
Luis Goldster67 visualizações
Stack queue por Hoang Nguyen
Stack queueStack queue
Stack queue
Hoang Nguyen485 visualizações
Stack queue por Harry Potter
Stack queueStack queue
Stack queue
Harry Potter101 visualizações
Stack queue por Tony Nguyen
Stack queueStack queue
Stack queue
Tony Nguyen141 visualizações
Data structures stacks por maamir farooq
Data structures   stacksData structures   stacks
Data structures stacks
maamir farooq373 visualizações
Note- Help with methods public boolean remove(Object o)- public boolea.pdf por actexerode
Note- Help with methods public boolean remove(Object o)- public boolea.pdfNote- Help with methods public boolean remove(Object o)- public boolea.pdf
Note- Help with methods public boolean remove(Object o)- public boolea.pdf
actexerode6 visualizações
Java Foundations StackADT-java --- - Defines the interface to a stack.docx por VictorXUQGloverl
Java Foundations StackADT-java ---  - Defines the interface to a stack.docxJava Foundations StackADT-java ---  - Defines the interface to a stack.docx
Java Foundations StackADT-java --- - Defines the interface to a stack.docx
VictorXUQGloverl2 visualizações
Stack and its applications por Ahsan Mansiv
Stack and its applicationsStack and its applications
Stack and its applications
Ahsan Mansiv179 visualizações
All code should be in C++Using the UnsortedList class (UnsortedLis.pdf por akashenterprises93
All code should be in C++Using the UnsortedList class (UnsortedLis.pdfAll code should be in C++Using the UnsortedList class (UnsortedLis.pdf
All code should be in C++Using the UnsortedList class (UnsortedLis.pdf
akashenterprises932 visualizações
I'm having trouble with PostfixTester-java and PostfixEvaluator-java- (1).docx por JacobUasThomsoni
I'm having trouble with PostfixTester-java and PostfixEvaluator-java- (1).docxI'm having trouble with PostfixTester-java and PostfixEvaluator-java- (1).docx
I'm having trouble with PostfixTester-java and PostfixEvaluator-java- (1).docx
JacobUasThomsoni4 visualizações
public class DoubleArraySeq implements Cloneable {    Priva.pdf por annaimobiles
public class DoubleArraySeq implements Cloneable {     Priva.pdfpublic class DoubleArraySeq implements Cloneable {     Priva.pdf
public class DoubleArraySeq implements Cloneable {    Priva.pdf
annaimobiles14 visualizações
helpInstructionsAdd the function max as an abstract function to .pdf por almonardfans
helpInstructionsAdd the function max as an abstract function to .pdfhelpInstructionsAdd the function max as an abstract function to .pdf
helpInstructionsAdd the function max as an abstract function to .pdf
almonardfans5 visualizações

Mais de anandhomeneeds

Driver.java import java.util.Scanner; import java.text.Decimal.pdf por
Driver.java import java.util.Scanner; import java.text.Decimal.pdfDriver.java import java.util.Scanner; import java.text.Decimal.pdf
Driver.java import java.util.Scanner; import java.text.Decimal.pdfanandhomeneeds
9 visualizações6 slides
Question 1,2,4 ------------------------------------Please check.pdf por
Question 1,2,4 ------------------------------------Please check.pdfQuestion 1,2,4 ------------------------------------Please check.pdf
Question 1,2,4 ------------------------------------Please check.pdfanandhomeneeds
3 visualizações15 slides
a) Since the presenceabsence of the Delta 32 gene is to be detected.pdf por
a) Since the presenceabsence of the Delta 32 gene is to be detected.pdfa) Since the presenceabsence of the Delta 32 gene is to be detected.pdf
a) Since the presenceabsence of the Delta 32 gene is to be detected.pdfanandhomeneeds
4 visualizações1 slide
You should notice that the domain and the range of quadratic functio.pdf por
You should notice that the domain and the range of quadratic functio.pdfYou should notice that the domain and the range of quadratic functio.pdf
You should notice that the domain and the range of quadratic functio.pdfanandhomeneeds
2 visualizações1 slide
HiCan you please summarise the question. More information confuse .pdf por
HiCan you please summarise the question. More information confuse .pdfHiCan you please summarise the question. More information confuse .pdf
HiCan you please summarise the question. More information confuse .pdfanandhomeneeds
3 visualizações1 slide
d1=c(D,S,C,H)d2=c(A,210,J,Q,K).pdf por
d1=c(D,S,C,H)d2=c(A,210,J,Q,K).pdfd1=c(D,S,C,H)d2=c(A,210,J,Q,K).pdf
d1=c(D,S,C,H)d2=c(A,210,J,Q,K).pdfanandhomeneeds
5 visualizações2 slides

Mais de anandhomeneeds(20)

Driver.java import java.util.Scanner; import java.text.Decimal.pdf por anandhomeneeds
Driver.java import java.util.Scanner; import java.text.Decimal.pdfDriver.java import java.util.Scanner; import java.text.Decimal.pdf
Driver.java import java.util.Scanner; import java.text.Decimal.pdf
anandhomeneeds9 visualizações
Question 1,2,4 ------------------------------------Please check.pdf por anandhomeneeds
Question 1,2,4 ------------------------------------Please check.pdfQuestion 1,2,4 ------------------------------------Please check.pdf
Question 1,2,4 ------------------------------------Please check.pdf
anandhomeneeds3 visualizações
a) Since the presenceabsence of the Delta 32 gene is to be detected.pdf por anandhomeneeds
a) Since the presenceabsence of the Delta 32 gene is to be detected.pdfa) Since the presenceabsence of the Delta 32 gene is to be detected.pdf
a) Since the presenceabsence of the Delta 32 gene is to be detected.pdf
anandhomeneeds4 visualizações
You should notice that the domain and the range of quadratic functio.pdf por anandhomeneeds
You should notice that the domain and the range of quadratic functio.pdfYou should notice that the domain and the range of quadratic functio.pdf
You should notice that the domain and the range of quadratic functio.pdf
anandhomeneeds2 visualizações
HiCan you please summarise the question. More information confuse .pdf por anandhomeneeds
HiCan you please summarise the question. More information confuse .pdfHiCan you please summarise the question. More information confuse .pdf
HiCan you please summarise the question. More information confuse .pdf
anandhomeneeds3 visualizações
d1=c(D,S,C,H)d2=c(A,210,J,Q,K).pdf por anandhomeneeds
d1=c(D,S,C,H)d2=c(A,210,J,Q,K).pdfd1=c(D,S,C,H)d2=c(A,210,J,Q,K).pdf
d1=c(D,S,C,H)d2=c(A,210,J,Q,K).pdf
anandhomeneeds5 visualizações
Hazaribagh and Singbhum of BiharSolutionHazaribagh and Singb.pdf por anandhomeneeds
Hazaribagh and Singbhum of BiharSolutionHazaribagh and Singb.pdfHazaribagh and Singbhum of BiharSolutionHazaribagh and Singb.pdf
Hazaribagh and Singbhum of BiharSolutionHazaribagh and Singb.pdf
anandhomeneeds4 visualizações
Answer 1- When the refrigerant is compressed, its temperature and pr.pdf por anandhomeneeds
Answer 1- When the refrigerant is compressed, its temperature and pr.pdfAnswer 1- When the refrigerant is compressed, its temperature and pr.pdf
Answer 1- When the refrigerant is compressed, its temperature and pr.pdf
anandhomeneeds3 visualizações
upload complete priblem somthing is missingSolutionupload comp.pdf por anandhomeneeds
upload complete priblem somthing is missingSolutionupload comp.pdfupload complete priblem somthing is missingSolutionupload comp.pdf
upload complete priblem somthing is missingSolutionupload comp.pdf
anandhomeneeds3 visualizações
The substrate in urease test is urea.The end products in urease te.pdf por anandhomeneeds
The substrate in urease test is urea.The end products in urease te.pdfThe substrate in urease test is urea.The end products in urease te.pdf
The substrate in urease test is urea.The end products in urease te.pdf
anandhomeneeds8 visualizações
f(x) = cos 4xf(16) = cos 4 = 12f(716) = cos 74 = 12again.pdf por anandhomeneeds
f(x) = cos 4xf(16) = cos 4 = 12f(716) = cos 74 = 12again.pdff(x) = cos 4xf(16) = cos 4 = 12f(716) = cos 74 = 12again.pdf
f(x) = cos 4xf(16) = cos 4 = 12f(716) = cos 74 = 12again.pdf
anandhomeneeds2 visualizações
the product will be a mixture of enantiomers of 2,3-dibromo -3-methy.pdf por anandhomeneeds
the product will be a mixture of enantiomers of 2,3-dibromo -3-methy.pdfthe product will be a mixture of enantiomers of 2,3-dibromo -3-methy.pdf
the product will be a mixture of enantiomers of 2,3-dibromo -3-methy.pdf
anandhomeneeds2 visualizações
AnswerFrom the passage the American who was stranger has behaved .pdf por anandhomeneeds
AnswerFrom the passage the American who was stranger has behaved .pdfAnswerFrom the passage the American who was stranger has behaved .pdf
AnswerFrom the passage the American who was stranger has behaved .pdf
anandhomeneeds4 visualizações
I think that 34SolutionI think that 34.pdf por anandhomeneeds
I think that 34SolutionI think that 34.pdfI think that 34SolutionI think that 34.pdf
I think that 34SolutionI think that 34.pdf
anandhomeneeds2 visualizações
(A) To show that e2x and ex are two linearly independent solutions o.pdf por anandhomeneeds
(A) To show that e2x and ex are two linearly independent solutions o.pdf(A) To show that e2x and ex are two linearly independent solutions o.pdf
(A) To show that e2x and ex are two linearly independent solutions o.pdf
anandhomeneeds34 visualizações
60 pieceSolution60 piece.pdf por anandhomeneeds
60 pieceSolution60 piece.pdf60 pieceSolution60 piece.pdf
60 pieceSolution60 piece.pdf
anandhomeneeds3 visualizações
Answer is A.  report an unrecognized net loss as an offset to the ne.pdf por anandhomeneeds
Answer is A.  report an unrecognized net loss as an offset to the ne.pdfAnswer is A.  report an unrecognized net loss as an offset to the ne.pdf
Answer is A.  report an unrecognized net loss as an offset to the ne.pdf
anandhomeneeds2 visualizações
Technically there is no volume haha, 420cm2 is an area. If you m.pdf por anandhomeneeds
Technically there is no volume haha, 420cm2 is an area. If you m.pdfTechnically there is no volume haha, 420cm2 is an area. If you m.pdf
Technically there is no volume haha, 420cm2 is an area. If you m.pdf
anandhomeneeds2 visualizações
The actions taken by the kernal in the operating system for a contex.pdf por anandhomeneeds
The actions taken by the kernal in the operating system for a contex.pdfThe actions taken by the kernal in the operating system for a contex.pdf
The actions taken by the kernal in the operating system for a contex.pdf
anandhomeneeds5 visualizações
Properties areMeanModeMedianQuartilesPercentilesRan.pdf por anandhomeneeds
Properties areMeanModeMedianQuartilesPercentilesRan.pdfProperties areMeanModeMedianQuartilesPercentilesRan.pdf
Properties areMeanModeMedianQuartilesPercentilesRan.pdf
anandhomeneeds2 visualizações

Último

Narration lesson plan por
Narration lesson planNarration lesson plan
Narration lesson planTARIQ KHAN
58 visualizações11 slides
CONTENTS.pptx por
CONTENTS.pptxCONTENTS.pptx
CONTENTS.pptxiguerendiain
57 visualizações17 slides
Ch. 7 Political Participation and Elections.pptx por
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptxRommel Regala
97 visualizações11 slides
Recap of our Class por
Recap of our ClassRecap of our Class
Recap of our ClassCorinne Weisgerber
77 visualizações15 slides
ICS3211_lecture 08_2023.pdf por
ICS3211_lecture 08_2023.pdfICS3211_lecture 08_2023.pdf
ICS3211_lecture 08_2023.pdfVanessa Camilleri
149 visualizações30 slides
The basics - information, data, technology and systems.pdf por
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdfJonathanCovena1
115 visualizações1 slide

Último(20)

Narration lesson plan por TARIQ KHAN
Narration lesson planNarration lesson plan
Narration lesson plan
TARIQ KHAN58 visualizações
CONTENTS.pptx por iguerendiain
CONTENTS.pptxCONTENTS.pptx
CONTENTS.pptx
iguerendiain57 visualizações
Ch. 7 Political Participation and Elections.pptx por Rommel Regala
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptx
Rommel Regala97 visualizações
ICS3211_lecture 08_2023.pdf por Vanessa Camilleri
ICS3211_lecture 08_2023.pdfICS3211_lecture 08_2023.pdf
ICS3211_lecture 08_2023.pdf
Vanessa Camilleri149 visualizações
The basics - information, data, technology and systems.pdf por JonathanCovena1
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdf
JonathanCovena1115 visualizações
MercerJesse2.1Doc.pdf por jessemercerail
MercerJesse2.1Doc.pdfMercerJesse2.1Doc.pdf
MercerJesse2.1Doc.pdf
jessemercerail169 visualizações
Solar System and Galaxies.pptx por DrHafizKosar
Solar System and Galaxies.pptxSolar System and Galaxies.pptx
Solar System and Galaxies.pptx
DrHafizKosar91 visualizações
MIXING OF PHARMACEUTICALS.pptx por Anupkumar Sharma
MIXING OF PHARMACEUTICALS.pptxMIXING OF PHARMACEUTICALS.pptx
MIXING OF PHARMACEUTICALS.pptx
Anupkumar Sharma77 visualizações
Psychology KS5 por WestHatch
Psychology KS5Psychology KS5
Psychology KS5
WestHatch93 visualizações
11.28.23 Social Capital and Social Exclusion.pptx por mary850239
11.28.23 Social Capital and Social Exclusion.pptx11.28.23 Social Capital and Social Exclusion.pptx
11.28.23 Social Capital and Social Exclusion.pptx
mary850239298 visualizações
Structure and Functions of Cell.pdf por Nithya Murugan
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdf
Nithya Murugan545 visualizações
Ch. 8 Political Party and Party System.pptx por Rommel Regala
Ch. 8 Political Party and Party System.pptxCh. 8 Political Party and Party System.pptx
Ch. 8 Political Party and Party System.pptx
Rommel Regala49 visualizações
AUDIENCE - BANDURA.pptx por iammrhaywood
AUDIENCE - BANDURA.pptxAUDIENCE - BANDURA.pptx
AUDIENCE - BANDURA.pptx
iammrhaywood84 visualizações
AI Tools for Business and Startups por Svetlin Nakov
AI Tools for Business and StartupsAI Tools for Business and Startups
AI Tools for Business and Startups
Svetlin Nakov107 visualizações
7 NOVEL DRUG DELIVERY SYSTEM.pptx por Sachin Nitave
7 NOVEL DRUG DELIVERY SYSTEM.pptx7 NOVEL DRUG DELIVERY SYSTEM.pptx
7 NOVEL DRUG DELIVERY SYSTEM.pptx
Sachin Nitave61 visualizações

later we create a specialstack class ,which inherits from stack cl.pdf

  • 1. //later we create a specialstack class ,which inherits from stack class.there we return the smallest integer //implementation #include #include using namespace std; /* A simple stack class named IntStack with push and pop operations */ class IntStack { private: static const int max = 100; int arr[max]; int top; public: //constructor for initialising value of top IntStack() { top = -1; } void push(int x); int pop(); bool isEmpty(); bool isFull(); }; /* Stack's member method to check if the stack is iempty */ bool IntStack::isEmpty() { if(top == -1) return true; return false; } /* Stack's member method to check if the stack is full */ bool IntStack::isFull() { if(top == max - 1)
  • 2. return true; return false; } /* Stack's member method push() to insert an element */ void IntStack::push(int x) { if(isFull()) { cout<<"Stack Overflow"; } top++; arr[top] = x; } /* Stack's member method pop() to remove an element from it */ int IntStack::pop() { if(isEmpty()) { cout<<"Stack Underflow"; abort(); } int x = arr[top]; top--; return x; } /* A class that supports all the stack operations and one additional operation getMIN() that returns the minimum element from stack at any time. This class inherits from the stack class and uses an auxiliarry stack that holds minimum elements */ class SpecialStack: public IntStack { IntStack min; public: //function declarations void push(int x); int pop(); int getMIN();
  • 3. }; /* SpecialStack's member method to insert an element to it. This method makes sure that the min stack is also updated with appropriate minimum values */ void SpecialStack::push(int x) { if(isEmpty()==true) { IntStack::push(x); min.push(x); } else { IntStack::push(x); int y = min.pop(); min.push(y); /* push only when the incoming element of main stack is smaller than or equal to top of auxiliary stack */ if( x <= y ) min.push(x); } } /* SpecialStack's member method to remove an element from it. This method removes top element from min stack also. */ int SpecialStack::pop() { int x = IntStack::pop(); int y = min.pop(); /* Push the popped element y back only if it is not equal to x */ if ( y != x ) min.push(y); return x; } /* SpecialStack's member method to get minimum element from it. */ int SpecialStack::getMIN()
  • 4. { int x = min.pop(); min.push(x); return x; } /* main program to test SpecialStack methods */ //execution starts here int main() { SpecialStack s; //push 3 elements and get the minimum s.push(15); s.push(25); s.push(33); cout< #include using namespace std; /* A simple stack class named IntStack with push and pop operations */ class IntStack { private: static const int max = 100; int arr[max]; int top; public: //constructor for initialising value of top IntStack() { top = -1; } void push(int x); int pop(); bool isEmpty(); bool isFull(); };
  • 5. /* Stack's member method to check if the stack is iempty */ bool IntStack::isEmpty() { if(top == -1) return true; return false; } /* Stack's member method to check if the stack is full */ bool IntStack::isFull() { if(top == max - 1) return true; return false; } /* Stack's member method push() to insert an element */ void IntStack::push(int x) { if(isFull()) { cout<<"Stack Overflow"; } top++; arr[top] = x; } /* Stack's member method pop() to remove an element from it */ int IntStack::pop() { if(isEmpty()) { cout<<"Stack Underflow"; abort(); } int x = arr[top]; top--; return x; }
  • 6. /* A class that supports all the stack operations and one additional operation getMIN() that returns the minimum element from stack at any time. This class inherits from the stack class and uses an auxiliarry stack that holds minimum elements */ class SpecialStack: public IntStack { IntStack min; public: //function declarations void push(int x); int pop(); int getMIN(); }; /* SpecialStack's member method to insert an element to it. This method makes sure that the min stack is also updated with appropriate minimum values */ void SpecialStack::push(int x) { if(isEmpty()==true) { IntStack::push(x); min.push(x); } else { IntStack::push(x); int y = min.pop(); min.push(y); /* push only when the incoming element of main stack is smaller than or equal to top of auxiliary stack */ if( x <= y ) min.push(x); } } /* SpecialStack's member method to remove an element from it. This method removes top element from min stack also. */
  • 7. int SpecialStack::pop() { int x = IntStack::pop(); int y = min.pop(); /* Push the popped element y back only if it is not equal to x */ if ( y != x ) min.push(y); return x; } /* SpecialStack's member method to get minimum element from it. */ int SpecialStack::getMIN() { int x = min.pop(); min.push(x); return x; } /* main program to test SpecialStack methods */ //execution starts here int main() { SpecialStack s; //push 3 elements and get the minimum s.push(15); s.push(25); s.push(33); cout< Solution //later we create a specialstack class ,which inherits from stack class.there we return the smallest integer //implementation #include #include using namespace std; /* A simple stack class named IntStack with push and pop operations */
  • 8. class IntStack { private: static const int max = 100; int arr[max]; int top; public: //constructor for initialising value of top IntStack() { top = -1; } void push(int x); int pop(); bool isEmpty(); bool isFull(); }; /* Stack's member method to check if the stack is iempty */ bool IntStack::isEmpty() { if(top == -1) return true; return false; } /* Stack's member method to check if the stack is full */ bool IntStack::isFull() { if(top == max - 1) return true; return false; } /* Stack's member method push() to insert an element */ void IntStack::push(int x) { if(isFull()) {
  • 9. cout<<"Stack Overflow"; } top++; arr[top] = x; } /* Stack's member method pop() to remove an element from it */ int IntStack::pop() { if(isEmpty()) { cout<<"Stack Underflow"; abort(); } int x = arr[top]; top--; return x; } /* A class that supports all the stack operations and one additional operation getMIN() that returns the minimum element from stack at any time. This class inherits from the stack class and uses an auxiliarry stack that holds minimum elements */ class SpecialStack: public IntStack { IntStack min; public: //function declarations void push(int x); int pop(); int getMIN(); }; /* SpecialStack's member method to insert an element to it. This method makes sure that the min stack is also updated with appropriate minimum values */ void SpecialStack::push(int x) { if(isEmpty()==true) {
  • 10. IntStack::push(x); min.push(x); } else { IntStack::push(x); int y = min.pop(); min.push(y); /* push only when the incoming element of main stack is smaller than or equal to top of auxiliary stack */ if( x <= y ) min.push(x); } } /* SpecialStack's member method to remove an element from it. This method removes top element from min stack also. */ int SpecialStack::pop() { int x = IntStack::pop(); int y = min.pop(); /* Push the popped element y back only if it is not equal to x */ if ( y != x ) min.push(y); return x; } /* SpecialStack's member method to get minimum element from it. */ int SpecialStack::getMIN() { int x = min.pop(); min.push(x); return x; } /* main program to test SpecialStack methods */ //execution starts here
  • 11. int main() { SpecialStack s; //push 3 elements and get the minimum s.push(15); s.push(25); s.push(33); cout< #include using namespace std; /* A simple stack class named IntStack with push and pop operations */ class IntStack { private: static const int max = 100; int arr[max]; int top; public: //constructor for initialising value of top IntStack() { top = -1; } void push(int x); int pop(); bool isEmpty(); bool isFull(); }; /* Stack's member method to check if the stack is iempty */ bool IntStack::isEmpty() { if(top == -1) return true; return false; } /* Stack's member method to check if the stack is full */
  • 12. bool IntStack::isFull() { if(top == max - 1) return true; return false; } /* Stack's member method push() to insert an element */ void IntStack::push(int x) { if(isFull()) { cout<<"Stack Overflow"; } top++; arr[top] = x; } /* Stack's member method pop() to remove an element from it */ int IntStack::pop() { if(isEmpty()) { cout<<"Stack Underflow"; abort(); } int x = arr[top]; top--; return x; } /* A class that supports all the stack operations and one additional operation getMIN() that returns the minimum element from stack at any time. This class inherits from the stack class and uses an auxiliarry stack that holds minimum elements */ class SpecialStack: public IntStack { IntStack min; public: //function declarations
  • 13. void push(int x); int pop(); int getMIN(); }; /* SpecialStack's member method to insert an element to it. This method makes sure that the min stack is also updated with appropriate minimum values */ void SpecialStack::push(int x) { if(isEmpty()==true) { IntStack::push(x); min.push(x); } else { IntStack::push(x); int y = min.pop(); min.push(y); /* push only when the incoming element of main stack is smaller than or equal to top of auxiliary stack */ if( x <= y ) min.push(x); } } /* SpecialStack's member method to remove an element from it. This method removes top element from min stack also. */ int SpecialStack::pop() { int x = IntStack::pop(); int y = min.pop(); /* Push the popped element y back only if it is not equal to x */ if ( y != x ) min.push(y); return x;
  • 14. } /* SpecialStack's member method to get minimum element from it. */ int SpecialStack::getMIN() { int x = min.pop(); min.push(x); return x; } /* main program to test SpecialStack methods */ //execution starts here int main() { SpecialStack s; //push 3 elements and get the minimum s.push(15); s.push(25); s.push(33); cout<