Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Q. Define a method for keeping two stacks within a single linear array S in such a way that neither stack overflows until entire array is used and a whole stack is never shifted to a different location within the array. Write down the routines for pushing and poping elements in two the stacks.
Ans.
/* The Two Stacks Into One Array */
#include
#define MAX 50
int mainarray[MAX];
int top1=-1,top2=MAX;
void push1(int elm)
{
if((top2-top1)==1)
clrscr();
printf("\n Array has been Filled !!!");
return;
}
mainarray[++top1]=elm;
void push2(int elm)
mainarray[--top2]=elm;
int pop1()
int temp;
if(top1<0)
printf(" \n This Stack Is Empty !!!");
return -1;
temp=mainarray[top1];
top1--;
return temp;
int pop2()
if(top2>MAX-1)
temp=mainarray[top2];
top2++;
Write an algorithm to print all even numbers in descending order and draw the flowchart
Q. By making use of stacks, write an algorithm to determine whether the infix expression has balanced parenthesis or not.
Count Scorecards(30 points) In a tournament, N players play against each other exactly once. Each game results in either of the player winning. There are no ties. You have given a
What is the best-case number of comparisons performed by mergesort on an input sequence of 2 k distinct numbers?
HEAP A heap is described to be a binary tree with a key in every node, such that 1-All the leaves of the tree are on 2 adjacent levels. 2- All leaves on the lowest leve
Mid Square method with good example
A town contains a total of 5000 houses. Every house owner has to pay tax based on value of the house. Houses over $200 000 pay 2% of their value in tax, houses over $100 000 pay 1.
By changing the NULL lines in a binary tree to the special links called threads, it is possible to execute traversal, insertion and deletion without using either a stack or recursi
A freight train from Melbourne is approaching Sydney, carrying n cars of cargos. The cargos are to be delivered to n different cities in the metropolitan area of Sydney - one car f
Before programming a problem solution those employees a stack, we have to decide how to represent a stack by using the data structures which exist in our programming language. Stac
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd