Display the contents of the astack in reverse order

Assignment Help Programming Languages
Reference no: EM13188719

A. Write a pseudocode/function that will delete from an unsorted linked list of integers the node that contains the smaller integer. Can you do this with a single traversal of the list?

B. Write a pseudocode/function to count the number of items(assume Integer items) in a linked list- Iteratively.

C. Convert each of the following infix expression to postfix. Use normal rules for precedence and associativity.

a. (4-11)*(6/7)+15

b. 13-8+3*9/12

c. a/b/(c-(d+c)*f+q*p%r

D. using the following postfix expressions, use a stack to solve them producing a final result.

a. 69 5 7 25 7 * +-18 25 5 / 20 25 20% +*+ ++

b. 4  7  3 + 8  10  * 2 6 / 9 3 % 11 - ++- +

E. Given a language: L ={w:w is of the   for some n>=0} write the pseudocode for a recursive function that will take as a parameter a string and test to see if that string belong to this language. The function will return true or false.

Using the following grammar (used for this specific assignment statement), graw a parse tree for the expression:

A=B-A/C * (A+C*B)

<assign> → <id> =<expr>

<id> → A | B | C

<expr> → <id> + <expr> | <id> * <expr> | (<expr>) | <id>-<<expr> | <id> / <expr>

|<id>

This grammar generates sentences(S) made up of nouns (N) and verbs(V). Generate two sentences that make sense and two that don't.

NOTE: NP is noun phrase and

            VP is verb Phrase

S → NP VP

NP  →  the N

VP  →  V NP

V  → sings | eats

N  → cat | song | canary

G. Show that you have two stacks - astack filled with data and auxstack which is empty-show how you can do each of the following tasks by using only the stack operations of the stack ADT we discussed in class. Make sure you also explain the steps you are doing in the order you are doing them.

a. Display the contents of the astack in reverse order; that is display the top last.

25

30

45

50

70

25

30

25

Astack

b. Count the number of items in astack, leaving astack unchanged.

c. Delete every occurrence of 25 from astack leaving the order of the remaining items unchanged.

H. Given the following array consisting of the nodes of a tree, draw the tree consisting of NON-EMPTY NODES ONLY.

NOTE: the & indicates an empty node.

A

B

&

C

&

D

&

E

&

&

&

F

&

G

&

H

Reference no: EM13188719

Questions Cloud

What effects would this philosophy have on the size : Some states are required to balance their budgets. Is this measure stabilizing or destabilizing Suppose all states were committed to a balanced budget philosophy and the economy moved into a recession. What effects would this philosophy have on th..
)what type of goods are pepsi and coke for mary : how many units of each product should she buy in order to maximize her utility. Show this utility maximiz- ing combination combination of Pepsi and Coke on the graph. how would her consumption and utility maximizing bundle of Coke and Pepsi change..
Architecting web-applications using web-services : Architecting web-applications using web-services has advantages. Forexample, you can gain increased security. Describe other advantages otherthan security gained by using web-services.
What percent of the bags weigh : A truck is loaded with bags of onions that weigh an average of 5 pounds with a standard deviation of 0.5 pounds. the histogram for the weights of the bags on the truck looks very much like a bell shaped curve of a normal distribution.
Display the contents of the astack in reverse order : Write a pseudocode/function that will delete from an unsorted linked list of integers the node that contains the smaller integer. Can you do this with a single traversal of the list?
What was the level of government spending : In the second quarter of 2006, household income was $13,134 billion, consumption was $9,162 billion, investment was $3,340 billion, and net exports were -$777 billion. What was the level of government spending in the second quarter of 2006
What is the amount of these three equal payments : A series of 10 annual payments of $7,500 is equivalent to three equal payments at the end of years 6, 10, and 15 at 15% interest compounded annually. What is the amount of these three equal payments
What is double counting in calculation gdp : draw a simple circular flow diagram with just firms:downstream firms that product final goods and services for consumption, and upstream in production only intermediate goods that are used by downstream firms in production.
Find the length of the flagpole : A flagpole is tilted at an angle of seven degrees from he horizontal and towards the sun. It casts a shadow of 14 meters when the angle of elevation of the sun is 43 degrees. Find the length of the flagpole.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a little man program that adds a column of input value

Write a Little Man program that adds a column of input values and produces the sum as output. An input value of zero will indicate the last value in the input stream of input values.

  Creating personnel promotion application program

The following application program will be modified to accommodate the change to the database table. The personnel promotion application program.

  Write vl program to convert leagues-number of nautical miles

Write a VL program which will convert 20,000 leagues to number of nautical miles. Your program requires no input elements, just elements to compute result and output how many nautical miles is equivalent to 20,000 leagues.

  Write a method that returns the value of base exponent

Write a method IntegerPower(base, exponent) that returns the value of base exponent For example, IntegerPower(3, 4) = 3 * 3 * 3 * 3.

  Write program which simulates checkout queue object

Write program which simulates checkout line at supermarket. Line is queue object. Customers (i.e., customer objects) arrive in random integer intervals of 1-4 minutes.

  Develop console application utilizes while loop to count

Develop a C++ console application which utilizes a while loop to count, total, and average series of positive integers entered by a user.

  Write an application to calculate the factorials

Write an application that calculates the factorials of 1 through 20. use type long. Display the results in tabular format. What difficulty might prevent you from calculating the factorial of 100?

  Explain inheritance structures of galaga

Write a 3-page paper about inheritance structures of Galaga. Recognize the parent and child classes and describe what each class has for events and data.

  Write a shell script to read from the keyboard

Write a shell script called poject. 21 to read from the keyboard and display on the monitor first name, last name and age if the age is less than 50. If the age is greater than 50, it will display your are over 5 instead of the age.

  Create program to enter expenses for the month

Create a program which asks the user to enter amount that he or she has budgeted for month. (For example: $2,000.00) A loop must then prompt the user to enter each of his or her expenses for month.

  Program to accept candy name price per pound

A program that accepts a candy name (for example, "chocolate-covered blueberries"), price per pound, and number of pounds sold in the average month, and displays the item's data.

  Write the code using recursive decent parser

Write the code, using recursive decent  parser and write the code, using a table-driven parser

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