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

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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