Write functions to push and pop the stack

Assignment Help Data Structure & Algorithms
Reference no: EM131119507

LinkedList Stack and LinkedList ADT C++

Part 1

Create a simple linked list program to create a class list containing

class node {

void *info; node *next;

public:

};

node (void *v) {info = v; next = O; } void put_next (node *n) {next = n;} node *get_next ( ) {return next;} void *get_info ( ) {return info;}

Be able to initially fill the list. Provide functions to insert/append nodes and remove nodes from the linked list. Be able to display the contents of the list.

Write a little driver program with at least 5 values passed in (so that 5 nodes are created) as you insert/append, delete and display data, showing the programs operation.

Part 2

Create a program that uses a derived class based on the list class you've created in the first program. This program will use a stack data type.

class node {

void *info; node *next;

public:

};

node (void *v) {info = v; next = O; } void put_next (node *n) {next = n;} node *get_next ( ) {return next;} void *get_info ( ) {return info;}

class list {

node *head; int node_num;

public:

list ( ) { node_num = O; head = O;}

void remove (int);

void insert (void *, int);

void append (void * v) {insert (v, node_num + I ); } void *find (int);

void display ( );

};

Write functions to push and pop the stack. Write a driver main program which gives 5 values (5 nodes created) that will push, pop and display data stored.

Reference no: EM131119507

Questions Cloud

Why do you think the bondholders wanted to block : Why do you think the bondholders wanted to block this transaction? What arguments can you make for and against the bondholders' case?
Explain the difference between direct and indirect costs : Explain the difference between direct and indirect costs for a healthcare organization. Provide and discuss at least one example of a direct cost in health care and one example of an indirect cost in health care.
Serving in the military or supporting : This program might help needy families, those serving in the military or supporting others that do, college students, people moving toward valuable vocational degrees, at-risk youth, people involved in environmental causes, or someone else deservi..
Revenue recognition membership fees midwest health club : She reviews the financial statements Nies prepared and tells Nies to recognize membership revenue when the fees are received. Answer the following questions.
Write functions to push and pop the stack : Write functions to push and pop the stack. Write a driver main program which gives 5 values (5 nodes created) that will push, pop and display data stored.
List of the most innovative businesses : Select an innovative company. This may be a company from the list of the most innovative businesses, or a business based on sharing (Uber, Zipcar, WeWork, Instacart, Rent the Runway, ThredUp, Chegg), or one that provides on demand service
What is the nature of your busines : What are the goals for your company/product? Your goals should be in quantitative terms, where possible, to facilitate measuring the company's future performance.
Why is earnings per share not a consistently good measure : Why is earnings per share not a consistently good measure of a firm’s performance?
Readers understand the larger themes of a story : Symbols help readers understand the larger themes of a story. One of the major themes of Joyce's "Araby" is the urge to escape the monotony of daily life. Which symbol in the story contributes most to this theme, and why?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Describe a radix-sort method for lexicographically sorting

Describe a radix-sort method for lexicographically sorting a sequence S of triplets (k,l,m),where k, l,and m are integers in the range[0,N-1]

  Universalist rationality theory

Universalist rationality theory supposes that actors within an institution are rational. They function with their own material interests in mind, maximizing efficiency and resources.

  find the minimum and maximum values in s

Given an array s =(s[1], s[2], . . . , s[n]), and n = 2^d for some d = 1. We want to find the minimum and maximum values in s. We do this by comparing elements of s.

  How many different undirected graphs are there

How many different undirected graphs are there with V vertices and E edges (and no parallel edges)?

  How to store and reference data in an array list

How to store and reference data in an array list and How to delete data from the ArrayList

  Algorithm for locating nth successor in circlar linked list

Write algorithm or code segment for locating nth successor of an item in circlar linked list (the nth item that follows the given item in the list).

  How a node''s left and right children could be reached

A stack is used to evaluate the following postfix expression. Show the state of the stack after the minus sign is processed and its state after the multiplication sign is processed.

  Apply algorithm on string to make substrings

For instance, applying algorithm on string 37540 must make the following substrings (not necessarily in this order): 0; 3; 75; 54; 375; 540.

  1 for a 77t truck with gross vehicle weight gvw of 136078

1. for a 77t truck with gross vehicle weight gvw of 136078 kg with dual rear tyres and a tyre inflation pressure is 120

  Substituted the following expression

can be substituted for. if (isalpha(c) && isdigit(c)) a) if...  The following expression can be substituted for. if (isalpha(c) && isdigit(c))  a) if (isalnum(c)) b) if (isalphanum(c))

  Determining ciphertext generated by encryption

Determine ciphertext (in binary form) generated by encryption of character X?

  Write a program in which you create an array of size twelve

Write a program in which you create an array of size 12 having all its elements initialized to -1. Then ask the user to enter a month number and the number of goals scored in that month.

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