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]
4 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]4 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
A spacecraft is fueled using hydrazine ​(N2H4​; molecular weight of 32 grams per mole​ [g/mol]) and carries 1 comma 630 kilogram
Varvara68 [4.7K]

Answer:

attached below

Explanation:

7 0
3 years ago
True False. First angle projection type used in United states.
Sloan [31]

Answer:

FALSE.

Explanation:

the correct answer is FALSE.

Projection is the process of representing the 3 D object on the flat surface.

there are four ways of representing the projection

1) First angle projection  

2) second angle projection

3) third angle projection

4) fourth angle projection.

Generally, people prefer First and third angle projection because there is no overlapping of the projection take place.

In USA people uses the third angle of projection.

5 0
3 years ago
What is protection scheme?
serg [7]

Answer:

The objective of a protection scheme is to keep the power system stable by isolating only the components that are under fault, whilst leaving as much of the network as possible still in operation.

Explanation:

The devices that are used to protect the power systems from faults are called protection devices.

5 0
3 years ago
T he area of a circle is pr 2. Define r as 5, then find the area of a circle,using MATLAB®.(b) The surface area of a sphere is 4
aksik [14]

Answer:

Area of Circle = 78.5398

Surface Area of Sphere =  1.2566 x 10^3 = 1256.6 ft

Volume of Sphere =  33.5103 ft

Explanation:

Please find below the written MatLab script used to solve the problem. I had to define r in each case to solve for the Area of the circle, the surface area and the volume of the Sphere.

r=5; % define r as 5

a=pi*r^2;% calculate the area of the circle

AreaOfCircle=a

r=10; % define r and 10 ft

sa=4*pi*r^2; %Calculate the surface area of the sphere

SphereSurfaceArea=sa

r=2;% define r as 2 ft

vs=(4/3)*pi*r^3;% Calculate the volume of the sphere

VolumeShere=vs

3 0
3 years ago
Read 2 more answers
1. There are two categories (shapes) for the Virginia driver's license. The ________________________ shape license represents th
dolphi86 [110]

Answer:

Vertical; horizontal.

Explanation:

The Virginia Department of Motor Vehicles started issuing sets of newly designed driver's licenses to drivers in 2009. Although, the cards that were issued to drivers prior to the introduction of the new cards remained valid until they were expired.

There are two categories (shapes) for the Virginia driver's license. The vertical shape license represents the driver who is under the age of 21, and the horizontal shaped license represents the driver who is over the age of 21.

Additionally, the Virginia's driver license (vertical in shape) issued to drivers who are under the age of 21 has a background image of a dogwood flower while the horizontal shaped license issued to drivers who are over the age of 21 has a background image of the state capitol.

5 0
3 years ago
Other questions:
  • A driver traveling at 65 mi/h rounds a curve on a level grade to see a truck overturned across the roadway at a distance of 350
    13·1 answer
  • Q7. A cylindrical rod of 1040 steel originally 15.2 mm (0.60 in.) in diameter is to be cold worked by drawing; the circular cros
    6·1 answer
  • The condition of irrotationality for a two-dimensional flow is satisfied when rotation w everywhere is (less than — equal to — m
    6·1 answer
  • Fix the code so the program will run correctly for MAXCHEESE values of 0 to 20 (inclusive). Note that the value of MAXCHEESE is
    8·1 answer
  • The engine of a 1500-kg automobile has a power rat- ing of 75 kW. Determine the time required to accelerate this car from rest t
    10·1 answer
  • Which statement is true about what will happen when the example code runs?1: main PROC2: mov edx,03: mov eax,404: push eax5: cal
    10·1 answer
  • A rectangular conductor with a cross sectional area of 1.04 square millimeters (mm) ^2 has a resistance of 0.075 ohms. What woul
    8·1 answer
  • Which of the following is a stealth aircraft designed to be invisible to enemy radar?
    5·1 answer
  • Which of the following sentences uses the active voice
    15·1 answer
  • Which best lists the careers that are part of the Science and Math career pathway?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!