Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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)

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9619041

Have any Question?


Related Questions in Computer Engineering

1 what do we mean by financial intelligence how to assess a

1. What do we mean by financial intelligence? How to assess a company's health? 2. Use the plain language to define operating experience, capital expenditure, accruals, depreciation, and goodwill. 3. Describe differences ...

Consider the following production function that is already

Consider the following production function that is already written in per worker terms: y = Akαh 1-α where h represents human capital per worker. Suppose we are given the following information: capital per worker in an e ...

Despite being noble gases xenon and radon actually form a

Despite being noble gases, xenon and radon actually form a small number of compounds. What is the partial pressure in atmospheres of radon in a mixture at STP composed of equal masses of xenon and radon?

Describe an ethical conundrum found in a magazine or

Describe an ethical conundrum found in a magazine or newspaper article, and please give your own thoughts. Give good citations, of course.

A street vendor is asking people to play a simple game you

A street vendor is asking people to play a simple game. You roll a pair of dice. If the sum on the dice is 10 or higher, you win $10. If you roll a pair of 1's, you win $59. Otherwise you lose $5. If the random variable ...

Question for this assignment you will continue your

Question: For this Assignment, you will continue your practice as a critical consumer of research. You will critically evaluate a scholarly article related to one-way ANOVA testing. To prepare for this Assignment: • Use ...

Recursive greatest common divisor the greatest common

(Recursive Greatest Common Divisor) The greatest common divisor of integers x and y is the largest integer that evenly divides both x and y. what is a recursive function gcd that returns the greatest common divisor of x ...

Identify and evaluate at least three considerations that

Identify and evaluate at least three considerations that one must plan for when designing a database. Suggest at least two types of databases that would be useful for small businesses, two types for regional level organi ...

Select a technology product process hardware software or

Select a technology (product, process, hardware, software, or any combination thereof). Laptop, Tablet, PDA 1. How do you characterize this technology (function, principle of operation, performance, etc.)? 2. Where does ...

Question need two different postsresponses with 200 words

Question: Need two different posts(responses) with 200 words each. After reviewing the assigned reading materials, complete the following activities: 1. Develop a product service idea. A. Describe the product/service inc ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As