Write a pseudocode-function to count the number of items

Assignment Help Data Structure & Algorithms
Reference no: EM13313683

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>

F. 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: EM13313683

Questions Cloud

Explain how many total moles of ions are released : How many total moles of ions are released when each of the following samples dissolves completely in water
Calculate total co2 emissions from two polices from 2011 : A more conservative increase from 27.5 mpg in 2011 to 35 mpg by 2020 is supported widely in Washington. California and 13 other states + the District of Columbia hope to increase that stander to 35 mpg by 2017 and 40 mpg by 2020.
What would height be after it was consolidated into packing : A 1m thick layer of this soil is packed so that it is as loose as possible (void ratio, e_max ~= 0.9), and then it was vibrated until it was as dense as possible (void ratio, e_min ~= 0.35).
State the silver-silver chloride electrode : What are the half-reactions for the following reference electrodes? Include physical states. 1) The silver-silver chloride electrode. 2)The saturated calomel electrode.
Write a pseudocode-function to count the number of items : 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.
Role of turkish armed forces in foreign policy making : Turkish israeli relations in the 1990's and the role of turkish armed forces in foreign policy making
Explain electrical discharge through a quantity of oxygen : Ozone (O3) can be prepared in the laboratory by passing an electrical discharge through a quantity of oxygen gas (O2): 3 O2 (g) -------> 2 O3 (g) A 10.00-L evacuated steel vessel is filled with 32.00 atm of pure O2 at 25°C.
How many neutron interactions per second occur in the target : A monoenergetic beam of neutrons, cp = 4 X 1 0 10 neutrons/cm2-sec, impinges on a target 1 cm2 in area and 0. 1 cm thick. How many neutron interactions per second occur in the target
Explain how to estimate the capacity of the existing system : The water level of the reservoir is 150 ft above that of the tank. The intake end of the pipeline is square-edged (k=0.5) and the water coes into the tank through a submerged end (k=1). You are told that the pipe is 12 in in diameter

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Create a solution algorithm using pseudocode

Algorithm that will receive two integer items from a terminal operator, and display to the screen their sum, difference, product and quotient.

  Transmitting image using raster scan order

If we were to transmit this image using raster scan order, after 15 seconds how many rows of the image will the user have received?

  Provide a description of the algorithm in pseudocode

Provide a description of the algorithm in pseudocode and conduct time complexity analysis of the algorithm

  Describe algorithm that finds maximum feasible flow in graph

Describe an algorithm that finds a maximum feasible flow in G. Denote by MF(|V|, |E|) the worst-case running time of an ordinary maximum flow algorithm.

  Creating a chart for it system

Make a chart that demonstrate the breakdown of the overall IT systems at a big corporation or breakdown a particular aspect of the IT systems such as the network or the business applications systems.

  Unctions for doing sort, search, display, replace, delete

create functions for doing sort, search, display, replace, delete, and add. You can use dynamic memory allocation for enlarge the size of pointer array for adding a new country.

  Explain dynamic array as big oh in terms of n

If we presently have n items in the dynamic array, how many doubling operations will we have executed so far? Explain this as Big Oh in terms of n.

  Calculate a three quarter moving average forecast

The Fastgro Fertilizer Corporation distributes fertilizer to various lawn and garden shops. Calculate a three-quarter moving average forecast for quarters 4 through 13 and calculate the forecast for each quarter.

  Create algorithm to calculate union of two input sets-array

Create algorithm to calculate union of two input sets given as arrays, both of size O(n). The output must be array of distinct elements that form union of the sets.

  Question about key encryption

Assume Alice wishes to send an e-mail to Bob. Bob has a public private key pair, Alice has Bob's certificate. But Alice does not have a public, private key pair.

  Mst (minimum spanning tree)

A graph has distinct edge weights. Does its lightest edge have to belong to the MST (Minimum Spanning Tree)? Can its heaviest edge belong to the MST?

  Returns true if a string contains properly nested

Give an algorithm that returns true if a string contains properly nested and balanced parentheses, and false if otherwise. Hint: At no time while scanning a legal string from left to right will you have encountered more right parentheses than left..

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