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

  The ace is played when both the king

The Ace is played when both the King and Queen are showing on the table, or when neither the King and Queen are showing on the table.

  Hardware platform of the target embedded systems

An embedded system is a computer system performing dedicated functions within a larger mechanical or electrical system. Embedded systems range from portable devices such as Google Glasses, to large stationary installations like traffic lights, fa..

  How to move from any spanning tree to other spanning tree

Illustrate that it is possible to move from any spanning tree T to any other spanning tree T0 by performing series of edge-swaps, that is, by moving from neighbor to neighbor.

  Determining worst-case time complexity

The recent discovery of the following fragment of uncommented procedural C code in the Sunlab has caused a big scandal. What is the worst-case time complexity of foo(a,1,N,k), and for which inputsdoes it occur?

  Question about hardware requirements

When you purchase a new software package, why does it state minimum RAM and hard drive space your computer must have for you to run this program?

  Creating code for a class called arrayqsn

Create all the code for a class called ArrayQsn. This class will contain 2-techniques. The first technique runningSumMean accepts an array of ints as a parameter, and will return the mean of the values as a double.

  Create time algorithm-minimum time required to finish task

Create the O(|V | + | E |) time algorithm which, given times ti and the dependencies, determines minimum time required to complete all the tasks.

  C program that accepts a month and day

Make a C program that accepts a month and day for example, June 14 from the keyboard as input. Store this data in a string called date.

  Question about edge connectivity

The edge connectivity of an indirected graph is minimum number k of edges that must be removed to disconnect the graph.

  Tree walk algorithm

We know how the regular tree walk algorithm works. If you have some values in the tree then the tree walk algorithm prints everything in order

  Explain compression algorithms are often used in forensics

"Compression algorithms are often used in forensics. Suppose you are involved in a case and have been asked by the lawyer to explain, in general terms.

  Construct an entity-relationship model for the database

Construct an entity-relationship (ER) model for the database. Make sure you include in your model details of entities, relationships, attributes, keys and limits in participation.

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