Create a C language program that can be used to construct any arbitrary Deterministic Finite Automaton corresponding to the FDA definition above. a. Create structs for the: automaton, a state, and a transition. For example, the automaton should have a "states" field, which captures its set of states as a linked list.

Answers

Answer 1

Answer:

see the explanation

Explanation:

/* C Program to construct Deterministic Finite Automaton */

#include <stdio.h>

#include <DFA.h>

#include <stdlib.h>

#include <math.h>

#include <string.h>

#include <stdbool.h>

struct node{

struct node *initialStateID0;

struct node *presentStateID1;

};

printf("Please enter the total number of states:");

scanf("%d",&count);

//To create the Deterministic Finite Automata

DFA* create_dfa DFA(){

  q=(struct node *)malloc(sizeof(struct node)*count);

  dfa->initialStateID = -1;

  dfa->presentStateID = -1;

  dfa->totalNumOfStates = 0;

  return dfa;

}

//To make the next transition

void NextTransition(DFA* dfa, char c)

{

  int tID;

  for (tID = 0; tID < pPresentState->numOfTransitions; tID++){

       if (pPresentState->transitions[tID].condition(c))

      {

          dfa->presentStateID = pPresentState->transitions[tID].toStateID;

          return;

      }

  }

  dfa->presentStateID = pPresentState->defaultToStateID;

}

//To Add the state to DFA by using number of states

void State_add (DFA* pDFA, DFAState* newState)

{  

  newState->ID = pDFA->numOfStates;

  pDFA->states[pDFA->numOfStates] = newState;

  pDFA->numOfStates++;

}

void transition_Add (DFA* dfa, int fromStateID, int(*condition)(char), int toStateID)

{

  DFAState* state = dfa->states[fromStateID];

  state->transitions[state->numOfTransitions].toStateID = toStateID;

  state->numOfTransitions++;

}

void reset(DFA* dfa)

{

  dfa->presentStateID = dfa->initialStateID;

}


Related Questions

A 75-hp (shaft output) motor that has an efficiency of 91.0 percent is worn out and is replaced by a high-efficiency 75-hp motor that has an efficiency of 96.3 percent. Determine the reduction in the heat gain of the room due to higher efficiency under full-load conditions.

Answers

Answer:

4.536hp

Explanation:

The decrease in the heat gain of the room is determined from difference in electrical inputs:

[tex]Q = W_{shaft} (\frac{1}{n_{1} } - \frac{1}{n_{2} })\\Q = (75hp)*(\frac{1}{0.91 } - \frac{1}{0.963 })\\\\Q = 4.536 hp[/tex]

Wheel diameter = 150 mm, and infeed = 0.06 mm in a surface grinding operation. Wheel speed = 1600 m/min, work speed = 0.30 m/s, and crossfeed = 5 mm. The number of active grits per area of wheel surface = 50 grits/cm2. Determine (a) average length per chip, (b) metal removal rate, and (c) number of chips formed per unit time for the portion of the operation when the wheel is engaged in the work.

Answers

Answer: a) 3mm

b) 5400mm^3/min

c) 4000000chips/min

Explanation:

Wheel diameter(D) =150mm

Infeed(W)=0.06mm

Wheel speed(V)=1600m/min

Work speed(Vw)=0.3m/s

Cross feed(d)=5mm

Number of active grits per area of wheel surface =50grits/cm^2

Average length per chip(Lc)=?

Metal removal rate(Rmr)=?

Number of chips formed per unit time(nc)=?

a) Lc=(Dd)^0.5

Lc=(150*0.06)^0.5

Lc=3mm

b) Rmr=VwWd

Rmr=(0.3m/s)*(10^3mm/m)*(5mm)*(0.06mm)

Rmr=5400mm^3/min

c) nc=VWc

nc=(1600m/min)(10^3)(5mm)(50grits/cm^2)(10^-2)

nc=4,000,000chips/min.

Consider an aircraft traveling at high speed. At a point on its wing, the local shear stress is 312 N/m2, and the local conductive heat transfer to the wing is 450 kW/m2. Calculate the air velocity and temperature gradients normal to the surface assuming that the surface has a temperature of 330 K.

Answers

Answer:

The air velocity is 1442.3m/s

The temperature gradient is 0.00311K/m

Explanation:

Rate of heat transfer = local conductive heat transfer × area

Rate of heat transfer = force × distance/time (distance/time = velocity)

Therefore, rate of heat transfer = force × velocity

Force (F) × velocity (v) = local conductive heat transfer coefficient (k) × Area (A)

F/A × v = k

Shear stress = F/A = 312N/m^2

k = 450kW/m^2 = 450×1000W/m^2 = 450000W/m^2

312 × v = 450000

v = 450000/312 = 1442.3m/s

Air velocity (v) = 1442.3m/s

Temperature gradient = Temperature (T)/distance (s)

From equations of motion

v^2 = u^2 + 2gs

u = 0m/s, v = 1442.3m/s, g = 9.8m/s^2

1442.3^2 = 2×9.8×s

s = 2080229.29/19.6 = 106134.15m

Temperature gradient = 330K/106134.15m = 0.00311K/m

Answer:

The solution is shown in the images attached with the answer.

Explanation:

Two capacitors with capacitances of 16 nF and 24 nF, respectively, are connected in parallel. This combination is then connected to a battery. If the charge on the 16 nF capacitor is 56 nC, what is the charge on the 24 nF capacitor

Answers

Answer:

charge on the 24 nF capacitor is 84 nC

Explanation:

given data

capacitance Q1 = 16 nF

capacitance Q2 = 24 nF

charge on the 16 nF capacitor C1 = 56 nC

solution

we get here capacitor in parallel have same voltage

V1 = V2   ...............1

here voltage V1 = [tex]\frac{Q1}{C1}[/tex]

[tex]\frac{Q1}{C1}[/tex] = [tex]\frac{Q2}{C2}[/tex]    .....................2

put here value we get

[tex]\frac{56}{16} = \frac{Q2}{24}[/tex]

Q = 84 nC

so charge on the 24 nF capacitor is 84 nC

Final answer:

The charge on the 24 nF capacitor, when paired in parallel with a 16 nF capacitor connected to the same battery, is determined to be 84 nC.

Explanation:

When two capacitors are connected in parallel and then to a battery, they both will have the same voltage across them. Given that the charge (Q) on a capacitor is equal to the product of its capacitance (C) and the voltage (V), and assuming the 16 nF capacitor has a charge of 56 nC, the charge on the 24 nF capacitor can be determined using the formula Q = CV.

First, find the voltage using the 16 nF capacitor:

V = Q/C = 56 nC / 16 nFV = 3.5 V

Since the capacitors are in parallel, the voltage across the 24 nF capacitor is also 3.5 V. Therefore, the charge on the 24 nF capacitor is:

Q = CV = 24 nF × 3.5 VQ= 84 nC

The charge on the 24 nF capacitor is 84 nC.

Consider a thin suspended hotplate that measures 0.25 m × 0.25 m. The isothermal plate has a mass of 3.75 kg, a specific heat of 2770 J/kg·K, and a temperature of 250°C. The ambient air temperature is 25°C and the surroundings temperature is 25°C. If the convection coefficient is 6.4 W/m2·K and the emissivity of the plate is 0.42, determine the time rate of change of the plate temperature, , when the plate temperature is 250°C. Evaluate the magnitude of the heat losses by convection and by radiation.

Answers

Answer:

Heat losses by convection, Qconv = 90W

Heat losses by radiation, Qrad = 5.814W

Explanation:

Heat transfer is defined as the transfer of heat from the heat surface to the object that needs to be heated. There are three types which are:

1. Radiation

2. Conduction

3. Convection

Convection is defined as the transfer of heat through the actual movement of the molecules.

Qconv = hA(Temp.final - Temp.surr)

Where h = 6.4KW/m2K

A, area of a square = L2

= (0.25)2

= 0.0625m2

Temp.final = 250°C

Temp.surr = 25°C

Q = 64 * 0.0625 * (250 - 25)

= 90W

Radiation is a heat transfer method that does not rely upon the contact between the initial heat source and the object to be heated, it can be called thermal radiation.

Qrad = E*S*(Temp.final4 - Temp.surr4)

Where E = emissivity of the surface

S = boltzmann constant

= 5.6703 x 10-8 W/m2K4

Qrad = 5.6703 x 10-8 * 0.42 * 0.0625 * ((250)4 - (25)4)

= 5.814 W

Final answer:

The time rate of change of the hotplate's temperature is 0.0062 K/s. The magnitude of the heat losses by convection and radiation is 64.23 W.

Explanation:

The question is asking for the time rate of change of the plate temperature when it is at 250°C and the magnitude of the heat losses by convection and by radiation.

First, transform the initial plate temperature from Celsius to Kelvin, so 250°C = 523.15 K.

The air temperature is also given in Celsius, which is 25°C = 298.15 K.

Next, we calculate the heat loss due to convection using the formula Q_conv = h * A * (T_plate - T_air), where h is the convection coefficient, A is the surface area of the plate, and T_plate and T_air are the temperatures of the plate and the air, respectively.

Substituting the given values, we get: Q_conv = 6.4 W/m^2.k * 0.25 m * 0.25 m * (523.15 K - 298.15 K) = 1.80 W.

The heat loss due to radiation can be calculated using the Stefan-Boltzmann law: Q_rad = ε * σ * A * (T_plate^4 - T_surrounding^4), where ε is the emissivity, σ is the Stefan-Boltzmann constant (5.67 * 10^-8 W/m^2.K^4), and T_surrounding is the surrounding temperature.

Again plugging in the given values, we get the heat loss due to radiation as Q_rad = 0.42 * 5.67 * 10^-8 W/m^2.K^4 * 0.25 m * 0.25 m * (523.15 K^4 - 298.15 K^4) = 62.43 W.

So, the total heat loss Q = Q_conv + Q_rad = 1.80 W + 62.43 W = 64.23 W.

To find the time rate of change of the temperature, we use the formula: dT/dt = Q / (m*C), where dT/dt is the time rate of change of the plate temperature, m is the mass, and C is the specific heat. Substituting the values, we get: dT/dt = 64.23 W / (3.75 kg * 2770 J/kg.K) = 0.0062 K/s.

Learn more about Heat Transfer here:

https://brainly.com/question/34419089

#SPJ3

Other Questions
which function represents exponential decay Sociologist Max Weber divided those who work for wages into two classes. The __________ class consists of skilled, semiskilled, and unskilled workers. Shortly after September 11th 2001, a researcher wanted to determine if the proportion of females that favored war with Iraq was significantly different from the proportion of males that favored war with Iraq. In a sample of 73 females, 28 favored war with Iraq. In a sample of 54 males, 29 favored war with Iraq.a) Let pF represent the proportion of females that favor the war, pM represent the proportion of males that favor the war. What are the proper hypotheses?A.)H0: pF = pM versus Ha: pF > pMB.)H0: pF < pM versus Ha: pF = pM C.)H0: pF = pM versus Ha: pF < pMD.)H0: pF = pM versus Ha: pF pMb) What is the test statistic? Compute the statistic using male statistics subtracted from female statistics. Give your answer to four decimal places. c) What is the P-value for the test? Give your answer to four decimal places. d) Using a 0.01 level of significance, what conclusion should be reached?A.)The proportion of females that favor the war and the proportion of males that favor the war are significantly different because the P-value is less than 0.01.B.)The proportion of females that favor the war and the proportion of males that favor the war are not significantly different because the P-value is greater than 0.01. C.)The proportion of females that favor the war and the proportion of males that favor the war are significantly different because the P-value is greater than 0.01.D.)The proportion of females that favor the war and the proportion of males that favor the war are not significantly different because the P-value is less than 0.01.e) What is the lower endpoint of a 99% confidence interval for the difference between the proportion of females that favor the war and the proportion of males that favor the war? Give your answer to four decimal places. f) What is the upper endpoint of a 99% confidence interval for the difference between the proportion of females that favor the war and the proportion of males that favor the war? Give your answer to four decimal places. Which of the following services or businesses would likely not be found in a lower-order settlement?A. a large farmB. a gas stationC. a big-box department storeD. a hospital specializing in cancer treatment Select the qualitative characteristics for the following statements. (a) Quality of information that permits users to identify similarities in and differences between two sets of economic phenomena. select a qualitative characteristic (b) Having information available to users before it loses its capacity to influence decisions. Select a qualitative characteristic (c) Information about an economic phenomenon that has value as an input to the processes used by capital providers to form their own expectations about the future. Select a qualitative characteristic (d) Information that is capable of making a difference in the decisions of users in their capacity as capital providers. Select a qualitative characteristic (e) Absence of bias intended to attain a predetermined result or to induce a particular behavior. Identify the solute with the highest van't Hoff factor. And how do you determine which one is highest? A) AlCl3. B) KI. C) CaCl2. D) MgSO4. E) non-electrolyte. According to information from the registrar's office, Lee has discovered that people who score higher on the SAT tend to have a higher GPA in their first year of college. Lee has used a(n) ________ research method.a. ethnographicb. correlationalc. experimentald. field study Martha visits a departmental store and discovers that a box of exotic candles will cost her ten percent more than what she had paid six months ago. The increase in prices is same across the country. In this scenario, which of the following statements is true?1. The departmental store is trying to earn profits by increasing the prices of its goods.2. She has to pay twelve percent more than what she paid last month.3. She will have immediate purchasing power if she had a pay raise to match the inflation.4. The candles' subjective value increases with the increase in inflation. The term "modeling" refers to ___________________, which allows artists to simulate three-dimensional forms in painted figures. the use of light and dark pigment tones the use of live models so artists could closely observe natural details the texturing of paint with a stippling brushstroke thickly applying paint in small areas. A manager who trains and mentors subordinates to assist them in achieving their full potential within the organization is acting primarily within which function?a. organizing b. leading c. demonstrating d. controlling e. planning Need help picture is displayed There are 15 numbers on a list, and the smallest number is changed from 12.9 to 1.29.a. Is it possible to determine by how much the mean changes? If so, by how much does it change?b. Is it possible to determine the value of the mean after the change? If so, what is the value?c. Is it possible to determine by how much the median changes? If so, by how much does it changes?d. Is it possible to determine by how much the standard deviation changes? If so, by how much does it change? The time Henry spends commuting to school can be represented by two expressions: Time to school: x 8y Time from school: 2x 4y Which expression represents the total time Henry spends commuting to and from school each day? 3x 12y 7x 12y x + 4y 3x + 4y Please translate this for me WITHOUT using google translate-He plays baseball in the summer because it is warm. It takes 9 minutes to fill an empty aquarium of a depth of 3/5 meters. What is the unit rate in minutes per meter? A technology based on placing brief digital recordings of live sounds under the control of a synthesizer keyboard is known as ______. Which of the following is not correct? a. The value of the economists language lies in its ability to provide you with a new and useful way of thinking about the world in which you live. b. Economists use some familiar words in specialized ways. c. Economics has its own language and its own way of thinking, but few other fields of study do. d. Supply, demand, elasticity, comparative advantage, consumer surplus, and deadweight loss are all terms that are part of the economists language. What are some common elements found in Islamic mosques? cement walls and pyramidal bases figurative sculpture and crenellated towers frescoes and carvings in high relief minarets and elaborate tile work What are pages called that are painted to look like textiles?A. carpet pagesB. embroidered pagesC. vellum pagesD. tapestry pages can you guys help me out. Steam Workshop Downloader