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++;
Program: Creation of a Circular linked list ALGORITHM (Insertion of an element into a Circular Linked List) Step 1 Begin Step 2 if the list is empty or new
REPRESENTATION OF ARRAYS This is not uncommon to determine a large number of programs which procedure the elements of an array in sequence. However, does it mean that the eleme
What do you understand by tree traversal? The algorithm walks by the tree data structure and performs some computation at everynode in the tree. This process of walking by the
A stack is a last in, first out (LIFO) abstract data type and sequential data structure. A stack may have any abstract data type as a component, but is characterized by two fundame
Ruby implementation of the Symbol ADT Ruby implementation of the Symbol ADT, as mentioned, hinges on making Symbol class instances immutable that corresponds to the relative la
Exact analysis of insertion sort: Let us assume the following pseudocode to analyse the exact runtime complexity of insertion sort. T j is the time taken to execute the s
What is quick sort? Quick sort is a sorting algorithm that uses the idea if split and conquer. This algorithm chooses an element called as pivot element; search its position in
Various graph traversal schemes Graph Traversal Scheme. In many problems we wish to investigate all the vertices in a graph in some systematic order. In graph we often do no
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
tree is graph or not
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