Write program to do operaretions of stack-push-pop-peek

Assignment Help Data Structure & Algorithms
Reference no: EM1388132

Write down the program which does the basic stack operations:
1. Make the stack
- if stack has not been created yet, go on with th initialization
- if stack exists, output warning message to the user if he/she wants to continue with deletion of data items stored in the stack

2. Push element into the stack
- for array implementation, ensure to check first for full stack before storing data item into stack (output a "stack overflow" message if the stack is full)
- if the stack is not full, output message to user once data item has been properly stored

3. Pop element from the stack
- for both implementations, ensure to check first for empty stack before proceeding with this operation
- output "stack underflow" message if stack is empty
- if the stack is not empty, proceed with deletion and return value of data item to calling function
- output value of data item which was popped out from stack

4. Take peek at top of the stack
- Just tell user what element is on top of stack

5. Show contents of the stack
- although this is not part of stack operations, you require this to check if elements/data items were inserted accurately

Take note that the following user-defined stack functions require to be in your program:
CreateStack
FullStack
EmptyStack
Push
Pop
Peek

Reference no: EM1388132

Questions Cloud

Diagnosis related groups : You work for local hospital, and your manager would like some clarification on diagnosis-related groups (DRGs). Critically discuss Medicare reimbursement in the context of DRGs for reimbursement purposes.
Extracellular biomolecule, agent endocytosed into the cell : Determine an extracellular biomolecule, agent, or nutrient that is endocytosed into the cell?
Probability exactly one voter is a democrat : If two registered voters are selected at random, what is the probability exactly one voter is a democrat?
What is reliability and what is validity : What is reliability? What is validity? Why are they important to successful academic research.
Write program to do operaretions of stack-push-pop-peek : Write down the program which does the basic stack operations: Make the stack. Push element into the stack. Pop element from the stack.
Quality improvement in health care : Critically discuss why there is such an emphasis on clinical quality issues in health care and discuss why clinical care is so important to Continuous Quality Improvement.
The level of ethnocentricity of an international firm : The level of ethnocentricity of an international firm business leader might influence his or her decisions relevant to cross-cultural issues
Chromosome from a single origin of replication : Suppose that the each replication fork moves at a rate of 500 base pairs per second, how long would it take to replicate the E. coli chromosome from a single origin of replication?
Overview of respiratory system : Working in health care industry, a medical professional should be familiar with the different systems in the body. The respiratory system is one such system that you might encounter when working as a medical billing and coding specialist.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Create a shell script to locate executable files

Create a shell script to locate executable documents? The script takes a list of document names from the command line and determines which would be executed had these names been given as commands.

  Create an er diagram

Create an E-R diagram with all appropriate notation for the following condition. In a particular fruit growing region there are a number of orchards.

  Explaining instruction format of operation code field

Operation code field, a mode field, to specify one of seven addressing modes, a register address field to specify one of 60 processor registers, and memory address. Specify instruction format and number of bits in each field if the instruction ..

  Analyzing the use of databases

Create a paper analyzing the use of databases in your company. Include what database applications are used. Conclude through proposing improvements.

  Design algorithms to implement stack operations

How to design algorithms to implement stack operations. Write down the program to multiply any two matrices. (Using Basic).

  Creating a flowchart

Create a flowchart to illustrate the given problem. You are given input for the student name, number of credits, and cost per credit.

  Discuss new security features in windows server

Which of the system changeover methods is the most expensive? Why? Which of the system changeover methods is the most risky? Why?

  Calculate the size of the state space as a function of n

n vehicles occupy squares (1, 1) through ( n , 1) (i.e., the bottom row) of an n × n grid. The vehicles must be moved to the top row but in reverse order

  Creating uml collaboration diagrams

Create UML collaboration diagrams using Microsoft Visio or another making tool capable of creating properly formatted UML collaboration diagrams.

  Why internet need http

Discuss why does the Internet need HTTP, TCP, IP and DNS? Explain why is not the Internet Protocol enough to do the job? Please reply to these specific points of confusion.

  Algorithm for finding smallest element in unsorted array

Consider the following algorithm for finding the smallest element in an unsorted array: RANDOMMIN(A[1 .. n]). What is the exact expected number of executions of line ( )?

  Design algorithm to read a file of employee records

Design an algorithm and souce code C++ that will read a file of employee records and produce a weekly report of gross earnings for those employees.

Free Assignment Quote

Assured A++ Grade

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!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd