Alpha Geek

(8)

$10/per page/Negotiable

About Alpha Geek

Levels Tought:
University

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Environmental science,Essay writing,Programming,Social Science,Statistics Hide all
Teaching Since: Apr 2017
Last Sign in: 347 Weeks Ago, 3 Days Ago
Questions Answered: 9562
Tutorials Posted: 9559

Education

  • bachelor in business administration
    Polytechnic State University Sanluis
    Jan-2006 - Nov-2010

  • CPA
    Polytechnic State University
    Jan-2012 - Nov-2016

Experience

  • Professor
    Harvard Square Academy (HS2)
    Mar-2012 - Present

Category > Programming Posted 10 May 2017 My Price 8.00

Write a method called expunge that accepts a stack

Write a method called expunge that accepts a stack of integers as a parameter and makes sure that the stack’s elements are in nondecreasing order from top to bottom, by removing from the stack any element that is smaller than any element(s) on top of it. For example, if the stack stores [4, 20, 15, 15, 8, 5, 7, 12, 3, 10, 5, 1], the element values 3, 7, 5, 8, and 4 should be removed because each has an element above it with a larger value. So your method should change the stack to store [20, 15, 15, 12, 10, 5, 1]. Notice that now the elements are in nondecreasing order from top to bottom. If the stack is empty or has just one element, nothing changes. Use one queue or stack (but not both) as auxiliary storage.

 

 

Answers

(8)
Status NEW Posted 10 May 2017 01:05 PM My Price 8.00

-----------

Attachments

1494423053-2178948_2_636299074987662819_sample-output.PNG
file 1494423082-Answer.docx preview (543 words )
W-----------rit-----------e a----------- me-----------tho-----------d c-----------all-----------ed -----------exp-----------ung-----------e t-----------hat----------- ac-----------cep-----------ts -----------a s-----------tac-----------k o-----------f i-----------nte-----------ger-----------s a-----------s a----------- pa-----------ram-----------ete-----------r a-----------nd -----------mak-----------es -----------sur-----------e t-----------hat----------- th-----------e s-----------tac-----------kâ€-----------™s -----------ele-----------men-----------ts -----------are----------- in----------- no-----------nde-----------cre-----------asi-----------ng -----------ord-----------er -----------fro-----------m t-----------op -----------to -----------bot-----------tom-----------, b-----------y r-----------emo-----------vin-----------g f-----------rom----------- th-----------e s-----------tac-----------k a-----------ny -----------ele-----------men-----------t t-----------hat----------- is----------- sm-----------all-----------er -----------tha-----------n a-----------ny -----------ele-----------men-----------t(s-----------) o-----------n t-----------op -----------of -----------it.----------- Fo-----------r e-----------xam-----------ple-----------, i-----------f t-----------he -----------sta-----------ck -----------sto-----------res----------- [4-----------, 2-----------0, -----------15,----------- 15-----------, 8-----------, 5-----------, 7-----------, 1-----------2, -----------3, -----------10,----------- 5,----------- 1]-----------, t-----------he -----------ele-----------men-----------t v-----------alu-----------es -----------3, -----------7, -----------5, -----------8, -----------and----------- 4 -----------sho-----------uld----------- be----------- re-----------mov-----------ed -----------bec-----------aus-----------e e-----------ach----------- ha-----------s a-----------n e-----------lem-----------ent----------- ab-----------ove----------- it----------- wi-----------th
Not Rated(0)