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!
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. Stacks might be represented in the computer in several ways, usually by means of a one-way list or a linear array. Each of the approach has its advantages & disadvantages. Generally a stack is implemented with two essential operations - push & pop. Push means to add an item on to stack. The push algorithm is sown in Figure.
Here, tos is a pointer which indicates the position of top most items into the stack. Stack is represented through the array arr and MAXSTACK represents the maximum possible number of elements into the stack. The pop algorithm is shown in Figure
Step 1: [test out for stack overflow]
if tos >=MAXSTACK
print "Stack is overflow" and exit
Step 2: [Increment the pointer value through one]
tos=tos+1
Step 3: [Add the item]
Step 4: Exit
arr[tos]=value
The pop operation eliminates the topmost item from the stack. After elimination of top most value tos is decremented by 1.
Step 1: [test out whether the stack is empty]
if tos = 0
print "Stack is underflow" and exit
Step 2: [Elimiante the top most item] value=arr[tos] tos=tos-1
Step 3: [Return the item of the stack]
return(value)
what is far and near procedures in system programming?
Suppose there are exactly five packet switches (Figure 4) between a sending host and a receiving host connected by a virtual circuit line (shown as dotted line in figure 4). The tr
Define null values. In some cases a particular entity might not have an applicable value for an attribute or if we do not know the value of an attribute for a particular entit
Give example of assertion and abstract data type For illustration, consider Natural ADT whose carrier set is the set of non-negative integers and whose operations are the usual
A tree is a non-empty set one component of which is designated the root of the tree while the remaining components are partitioned into non-empty groups each of which is a subtree
Thread By changing the NULL lines in a binary tree to special links known as threads, it is possible to perform traversal, insertion and deletion without using either a stack
Determine about the push operation A Container may or may not be accessible by keys, so it can't make assumptions about element retrieval methods (for example, it cannot have a
Define the term - Array A fixed length, ordered collection of values of same type stored in contiguous memory locations; collection may be ordered in several dimensions.
Define the Carrier set of the Symbol ADT Carrier set of the Symbol ADT is the set of all finite sequences of characters over Unicode characters set (Unicode is a standard char
In this unit, we will describe a data structure called Graph. Actually, graph is a general tree along no parent-child relationship. In computer science, Graphs have several applica
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