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

  Creating an automated checkout program

A local department store employee you to create an automated checkout program to expedite customers in a hurry. The checkout line can only allow 5-products for any one purchase.

  Create algorithm to read file of employee records

Create the algorithm which will read a file of employee records and produce the weekly report of gross earnings for those employees.

  Organizing the data in ms excel

Many of your family members have discovered that you are using Excel to organize the information for the high school reunion. Your Uncle Larry wants to make an inventory of the over 800 video games that he collects.

  Designing and populating a course table

Use data to design and populate a course table. Designate the CourseID field as a Primary Key and permit your database to automatically produce a value for this field.

  Creating database for a human resources group

Construct a database for a human resources group. List a few different tables and columns to store the HR information.

  Data systems and design

Suppose if you have a program with a housekeep() module, a mainloop() module, and a finishup() module, when is the second input record usually read?

  Algorithm to compute-report grade-point average for class

Compute and report grade-point average for class. Determine the sum of the grades; count number of students; compute average. Determine its algorithm?

  Question about oracle9i database

Provide every worker in the Local Locale Company the privileges required to query and update the NEWS_ARTICLE table and the CLASSIFIED_AD table.

  Algorithm to read arbitrary number of data records

Write the algorithm to read arbitrary number of data records, each comprising name, age, and code.

  Explain how to modify knuth-morris-pratt algorithm

Explain how to modify Knuth-Morris-Pratt algorithm to support patterns with these wild cards, and analyze modified algorithm. Your algorithm must find first substring in text which matches the pattern.

  Dbms and data mining to imporve customer service

Discuss how a database management system and data mining can help motor vehicle maintenance center improve its services, and what tables would be required in such a database.

  Write algorithm to calculate the median using queries

Calculate the median using as few queries as possible. Provide an algorithm which determines the median value using at most O(lg n) queries.

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