1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andreas93 [3]
3 years ago
6

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.
Engineering
1 answer:
otez555 [7]3 years ago
5 0

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;

}

You might be interested in
What are the potential hazards relating to materials handling injuries?
Ann [662]

Answer:

it's says potential that something not moving.

incorrectly cutting ties or securing devices because

this is so dangerous thing I know because being electrocuted is here this for me.

8 0
3 years ago
A piston-cylinder assembly has initially a volume of 0.3 m3 of air at 25 °C. Mass of the air is 1 kg. Weights are put on the pis
kogti [31]

Answer:

n=2.32

w= -213.9 KW

Explanation:

V_1=0.3m^3,T_1=298 K

V_2=0.1m^3,T_1=1273 K

Mass of air=1 kg

For polytropic process  pv^n=C ,n is the polytropic constant.

  Tv^{n-1}=C

  T_1v^{n-1}_1=T_2v^{n-1}_2

298\times .3^{n-1}_1=1273\times .1^{n-1}_2

n=2.32

Work in polytropic process given as

       w=\dfrac{P_1V_1-P_2V_2}{n-1}

      w=mR\dfrac{T_1-T_2}{n-1}

Now by putting the values

w=1\times 0.287\dfrac{289-1273}{2.32-1}

w= -213.9 KW

Negative sign indicates that work is given to the system or work is done on the system.

For T_V diagram

  We can easily observe that when piston cylinder reach on new position then volume reduces and temperature increases,so we can say that this is compression process.

5 0
3 years ago
A piston-cylinder apparatus has a piston of mass 2kg and diameterof
iragen [17]

Answer:

M =2.33 kg

Explanation:

given data:

mass of piston - 2kg

diameter of piston is 10 cm

height of water 30 cm

atmospheric pressure 101 kPa

water temperature = 50°C

Density of water at 50 degree celcius is 988kg/m^3

volume of cylinder is  V = A \times h

                                       = \pi r^2 \times h

                                       = \pi 0.05^2\times 0.3

mass of available in the given container is

M = V\times d

  = volume \times density

= \pi 0.05^2\times 0.3 \times 988

M =2.33 kg

6 0
3 years ago
Route Choice The cost of roadway improvements to the developer is a function of the amount of traffic being generated by the the
aksik [14]
Row choice the cost of roadway improvements to the developer and functional the amount of trafficBeing generated by the theater as well as the Ralph’s ladies
7 0
2 years ago
PythonA group of statisticians at a local college has asked you to create a set of functionsthat compute the median and mode of
skelet666 [1.2K]

Answer:

  1. def median(l):
  2.    if(len(l) == 0):
  3.       return 0
  4.    else:
  5.        l.sort()
  6.        if(len(l)%2 == 0):
  7.            index = int(len(l)/2)
  8.            mid = (l[index-1] + l[index]) / 2
  9.        else:
  10.            mid = l[len(l)//2]  
  11.        return mid  
  12. def mode(l):
  13.    if(len(l)==0):
  14.        return 0
  15.    mode = max(set(l), key=l.count)
  16.    return mode  
  17. def mean(l):
  18.    if(len(l)==0):
  19.        return 0
  20.    sum = 0
  21.    for x in l:
  22.        sum += x
  23.    mean = sum / len(l)
  24.    return mean
  25. lst = [5, 7, 10, 11, 12, 12, 13, 15, 25, 30, 45, 61]
  26. print(mean(lst))
  27. print(median(lst))
  28. print(mode(lst))

Explanation:

Firstly, we create a median function (Line 1). This function will check if the the length of list is zero and also if it is an even number. If the length is zero (empty list), it return zero (Line 2-3). If it is an even number, it will calculate the median by summing up two middle index values and divide them by two (Line 6-8). Or if the length is an odd, it will simply take the middle index value and return it as output (Line 9-10).

In mode function, after checking the length of list, we use the max function to estimate the maximum count of the item in list (Line 17) and use it as mode.

In mean function,  after checking the length of list,  we create a sum variable and then use a loop to add the item of list to sum (Line 23-25). After the loop, divide sum by the length of list to get the mean (Line 26).

In the main program, we test the three functions using a sample list and we shall get

20.5

12.5

12

3 0
3 years ago
Other questions:
  • What is a thermal reservoir?
    15·1 answer
  • You have designed a treatment system for contaminant Z. The treatment system consists of a pipe that feeds into a CSTR. The pipe
    8·1 answer
  • A large prime number isP = 232582657 - 1
    8·1 answer
  • Find the equivalent impedance Zeq seen by the source when Vs = 2 cos (5t) v, C = 0.2 F, R = 1 Ω and L = 0.1 H. (Give angles in d
    12·1 answer
  • Different types of steels contain different elements that alter the characteristics of the steel. For each of the following elem
    6·1 answer
  • All of the following are categories for clutch covers except
    11·1 answer
  • Michelle is the general manager of a power plant. This morning, she will meet with city officials to discuss environmental issue
    5·1 answer
  • How long does it take electrons to get from a car battery to the starting motor? Assume the current is 300 A and the electrons t
    10·1 answer
  • What are practical considerations you might encounter when you increase the moment of inertia (I) while keeping the cross-sectio
    13·1 answer
  • During welding in the vertical position, the torch angle can be varied to control sagging.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!