DFA diagram to recognize arithmetic expressions
I need to draw a DFA diagram that can recognize arithmetic expressions, varialbes or brackets are not allowed. It can only contain numbers and four arithmetic operators.
And it has to accepts any number string with or without sign  e.g. 5, 7 , +15. And the numbers strings can be mixed with arithmetic operators  e.g. 3+5 , 1+7*3.
I don't know if my diagram actually performs this requirements.
See also questions close to this topic

Consider the following recurrence defining a function f : N → N
f(n) = 10, n = 0
f(n) = 100f(⌊n/5⌋) + n^2 * 3^n, n > 0
Prove that there is a constant c > 0 so that for all sufficiently large integers n f(n) ≤ c * n^2 * 3^n

Solving math equations with fractions on google scripts
https://docs.google.com/spreadsheets/d/1s0tltmOLDwWmjROBZN_ibpfc5jcnPk6aUaQvLp80/edit?usp=sharing
So I am making a Google Sheets program to create a math worksheet that randomly generates the numbers within certain parameters.
I have succeeded in addition, subtraction, a mix of addition and subtraction, and multiplication. I am now trying to add fractions to the mix, but have run into the formatting issue. While I have been able to generate random fractions and have them appear correctly, the issue comes in trying to have the correct answer generate on the Key sheet.
I have tried finding a way to read the cells occupied by fractions as a string and parse out the individual numbers however that would only solve the issue with the numerator, and I still have the issue with the denominator (finding the common one or at least having the answer one that can be simplified by the student or teacher after solved).
I included a link above, please let me know if you have any ideas to help with this issue.
Also since I don't think I have it properly documented in the script, the max value of integers generated is located on the key page in the range "K2"
function myWSG() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var ws = ss.getSheetByName("Worksheet"); var ks = ss.getSheetByName("Key"); var m = ks.getRange('K2').getValue()+1; function getRandomInt(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max  min)) + min; //The maximum is exclusive and the minimum is inclusive } for (var i = 8; i <= 26; i = i + 2){ var num = getRandomInt(0, m); var num1 = getRandomInt(0, m); var dn1 = getRandomInt(0, m); var dn2 = getRandomInt(0, m); var sym = getRandomInt(0, 2); ws.getRange("A1").copyFormatToRange(ws, 3, 3, i, i) ws.getRange("A1").copyFormatToRange(ws, 5, 5, i, i) switch(ws.getRange(6, 5).getValue()){ case "Fractions": ks.getRange("A6").setValue("Fractions"); if(dn1 == 0){ ws.getRange(i, 3).setValue(num) } else if(dn1 == 1){ ws.getRange(i, 3).setValue(num) } else{ ws.getRange(i, 3).setValue(num + "/" + dn1); } if(dn2 == 0){ ws.getRange(i, 5).setValue(num1) } else if(dn2 == 1){ ws.getRange(i, 5).setValue(num1) } else{ ws.getRange(i, 5).setValue(num1 + "/" + dn2); } break; case "Add&Sub": ks.getRange("A6").clearContent(); if(num > num1){ ws.getRange(i, 3).setValue(num); ws.getRange(i, 5).setValue(num1); } else{ ws.getRange(i, 3).setValue(num1); ws.getRange(i, 5).setValue(num); } if(sym == 0){ ws.getRange(i, 4).setValue('+') } else{ ws.getRange(i, 4).setValue('') } break; case "Addition": ks.getRange("A6").setValue("Fractions") ws.getRange(i, 4).setValue('+'); if(num > num1){ ws.getRange(i, 3).setValue(num); ws.getRange(i, 5).setValue(num1); } else{ ws.getRange(i, 3).setValue(num1); ws.getRange(i, 5).setValue(num); } break; case "Subtraction": ks.getRange("A6").setValue("Fractions") ws.getRange(i, 4).setValue(''); if(num > num1){ ws.getRange(i, 3).setValue(num); ws.getRange(i, 5).setValue(num1); } else{ ws.getRange(i, 3).setValue(num1); ws.getRange(i, 5).setValue(num); } break; case "Multiplication": ks.getRange("A6").setValue("Fractions") ws.getRange(i, 4).setValue('x'); ws.getRange(i, 3).setValue(num); ws.getRange(i, 5).setValue(num1); break; } } for (var v = 30; v <= 46; v = v + 3){ var vnum = getRandomInt(0, m); //random Integer 1 var vnum1 = getRandomInt(1, m); //random Integer 2 var vnum2 = getRandomInt(0, m); //random Integer 3 var vnum3 = getRandomInt(1, m); //random Integer 4 var vsym = getRandomInt(0, 2); //Symbol determinate var vsym1 = getRandomInt(0, 2); //Symbol determinate 2 var vdn1 = getRandomInt(0, m); //random denominator 1 var vdn2 = getRandomInt(0, m); //random denominator 2 ws.getRange("A1").copyFormatToRange(ws, 3, 3, v, v); //Reset Format to ws.getRange("A1").copyFormatToRange(ws, 5, 5, v, v); //Reset Format to ws.getRange("N1").copyFormatToRange(ws, 3, 3, v+1, v+1); //Reset Format ws.getRange("N1").copyFormatToRange(ws, 5, 5, v+1, v+1); //Reset Format switch(ws.getRange(6, 5).getValue()){ case "Fractions": if(vdn1 == 0){ ws.getRange(v, 3).setValue(vnum); } else if(vdn1 == 1){ ws.getRange(v, 3).setValue(vnum); } else{ ws.getRange(v, 3).setValue(vnum + "/" + vdn1); ws.getRange(v, 5).setValue(vnum2 + "/" + vdn1); } if(vdn2 == 0){ ws.getRange(v+1, 3).setValue(vnum1); } else if(vdn2 == 1){ ws.getRange(v+1, 3).setValue(vnum1); } else{ ws.getRange(v+1, 3).setValue(vnum1 + "/" + vdn2); ws.getRange(v+1, 5).setValue(vnum3 + "/" + vdn2); } break; case "Add&Sub": if(vnum > vnum1){ ws.getRange(v, 3).setValue(vnum); ws.getRange(v+1, 3).setValue(vnum1); } else{ ws.getRange(v, 3).setValue(vnum1); ws.getRange(v+1, 3).setValue(vnum); } if(vnum2 > vnum3){ ws.getRange(v, 5).setValue(vnum2); ws.getRange(v+1, 5).setValue(vnum3); } else{ ws.getRange(v, 5).setValue(vnum3); ws.getRange(v+1, 5).setValue(vnum2); } if(vsym == 0){ ws.getRange(v+1, 2).setValue('+'); } else{ ws.getRange(v+1, 2).setValue(''); } if(vsym1 == 0){ ws.getRange(v+1, 4).setValue(''); } else{ ws.getRange(v+1, 4).setValue('+'); } break; case "Addition": ws.getRange(v+1, 2).setValue('+'); ws.getRange(v+1, 4).setValue('+'); ws.getRange(v, 3).setValue(vnum); ws.getRange(v+1, 3).setValue(vnum1); ws.getRange(v, 5).setValue(vnum2); ws.getRange(v+1, 5).setValue(vnum3); break; case "Subtraction": ws.getRange(v+1, 2).setValue(''); ws.getRange(v+1, 4).setValue(''); if(vnum > vnum1){ ws.getRange(v, 3).setValue(vnum); ws.getRange(v+1, 3).setValue(vnum1); } else{ ws.getRange(v, 3).setValue(vnum1); ws.getRange(v+1, 3).setValue(vnum); } if(vnum2 > vnum3){ ws.getRange(v, 5).setValue(vnum2); ws.getRange(v+1, 5).setValue(vnum3); } else{ ws.getRange(v, 5).setValue(vnum3); ws.getRange(v+1, 5).setValue(vnum2); } break; case "Multiplication": ws.getRange(v+1, 2).setValue('x'); ws.getRange(v+1, 4).setValue('x'); ws.getRange(v, 3).setValue(vnum); ws.getRange(v+1, 3).setValue(vnum1); ws.getRange(v, 5).setValue(vnum2); ws.getRange(v+1, 5).setValue(vnum3); break; } } for ( var s = 8; s <= 26; s = s + 2){ ks.getRange(s, 7).clearContent(); } for ( var s2 = 32; s2 <= 47; s2 = s2 + 3){ ks.getRange(s2, 3).clearContent(); ks.getRange(s2, 5).clearContent(); } } function myKSG() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var ws = ss.getSheetByName("Worksheet"); var ks = ss.getSheetByName("Key"); for ( var s = 8; s <= 26; s = s + 2){ var nm = ks.getRange(s, 3).getValue(); var nm1 = ks.getRange(s, 5).getValue(); switch(ws.getRange(s, 4).getValue()){ case "+": ws.getRange(s, 4).copyFormatToRange(ks, 7, 7, s, s); ks.getRange(s, 7).setValue(nm + nm1); break; case "": ws.getRange(s, 4).copyFormatToRange(ks, 7, 7, s, s); ks.getRange(s, 7).setValue(nm  nm1); break; case "x": ws.getRange(s, 4).copyFormatToRange(ks, 7, 7, s, s); ks.getRange(s, 7).setValue(nm * nm1); break; } } for ( var s2 = 32; s2 <= 47; s2 = s2 + 3){ var vm = ks.getRange(s2  2, 3).getValue(); var vm1 = ks.getRange(s2  1, 3).getValue(); var vm2 = ks.getRange(s2  2, 5).getValue(); var vm3 = ks.getRange(s2  1, 5).getValue(); if( ks.getRange(s21, 2).getValue() == "+"){ ks.getRange(s2, 3).setValue(vm + vm1); } else if(ks.getRange(s21, 2).getValue() == ""){ ks.getRange(s2, 3).setValue(vm  vm1); } else if(ks.getRange(s21, 2).getValue() == "x"){ ks.getRange(s2, 3).setValue(vm * vm1); } if( ks.getRange(s21, 4).getValue() == "+"){ ks.getRange(s2, 5).setValue(vm2 + vm3); } else if(ks.getRange(s21, 4).getValue() == ""){ ks.getRange(s2, 5).setValue(vm2  vm3); } else if(ks.getRange(s21, 4).getValue() == "x"){ ks.getRange(s2, 5).setValue(vm2 * vm3); } } }

Find the number of distinct ways of writing '1' as a sum of fractions, each with '1' as numerator and a power of '2' as denominator
I am given a number
n
and I have to find the number of distinct ways of writing the number1
as a sum ofn
fractions, where each fraction has the following format: The numerator is always 1.
 The denominator is a power of 2 (for example 2^1, 2^2, etc).
Two methods of writing
1
as a sum of such fractions are NOT distinct if they contain the same fractions. For example, let's sayn=4
. One way of writing1
as a sum of4
fractions would be the following:1/2 + 1/4 + 1/8 + 1/8
. But writing it as1/8 + 1/4 + 1/2 + 1/8
is considered the same(because it contains the exact same fractions, only the order changed) and therefore NOT distinct when compared to the first way of writing. So forn=4
there would only be two ways of writing1
as a sum of 4 fractions. The first would be1/2 + 1/4 + 1/8 + 1/8
(the one mentioned above) and the second would be1/4 + 1/4 + 1/4 + 1/4
. So the result would be2
. The boundaries ofn
are :2 <= n <= 2000
.I wrote the first few on paper (for
n=2
, forn=3
, forn=4
and a few more) and I thought that the results are part of the Fibonacci sequence so that's what I tried but when I sent the source on the site it said that it is wrong. I have a feeling that I have to use dynamic programming but I am not sure how to implement it. Any help would be very appreciated. Thanks a lot! 
How does the expression "*(p++)+=(*p++)" work?
Here the code:
int a[3] = { 7,0,4 }; int *p = a; *(p++) += (*p++);
after the operation above, the array
a[3] = {14, 0, 4}
, I don't know whya[0]=14
. In my opinion, the steps should be*p = 7 > p++ > *p = 0 >p++ > *p = 0 + 7
, buta[0]
seems to calculate like*p = 7 + 7
. 
What is the meaning of  in Javascript
What does  do in Javascript? Is it similar to the logical or operator

? I have seen it being used to apparently convert strings to numbers. How does this work?var x = '12345'; var num = x0; console.log(num);

Calculate lists in Python 3.7
I was wondering if it was possible to calculate a list, for example this one
calculation = [1, "+", 2, "*", 15]
so it returns 31.

How to open a .NVGCHTBIN file
I have a file that appears to be a flow chart, however, it is in the format of XXX.NVGCHTBIN
I have tried every different notepad program I have, Microsoft Visio, pdf viewers, image viewers, and even some sketchy looking programs off google that claimed they could open this type of file.
I absolutely can't figure out how to open this file. Any help would be appreciated.

Regarding 1 to 1 associations in UML class models
We often encounter class models, in UML modeling, that state a 1 x 1 or 1 x 1..* or 1..* x 1 or 1..* x 1..* association between given classes.
Take the example: Player 1..11 x 1 Team.
Wouldn't that impose a practical problem, in which it wouldn't be possible to determine what comes first: the team or a player? In the example, a team would need a player, at least, to exist, while a player, to exist, needs the team. Am I misinterpreting something?
Trying to implement it, you wouldn't be able to instantiate a Team, because you'd need at least one Player, and if you try to instantiate the Player, the Team would be missing.
How are 1 x 1 associations possible?
Thank you for your time!

Getting this error: TypeError: Cannot read property 'setMaxNumberPointsPerLink' of null
I'm using this library for diagrams.
I've my code in componentWillMount like so,
class FlowDiagramEngine extends Component { constructor(props) { super(props); this.flowJson = this.props.flowDiagramData; this.state = {}; } componentWillMount() { console.log("this.flowJson :"+this.flowJson); // this is empty var engine = ... engine.setDiagramModel(model); .... all code to construct diagram this.setState({engine: engine}); } render() { return ( <div> <FlowDiagramWidget className="srddemocanvas" {...this.state} /> </div> ) } }
FlowDiagramWidget
class FlowDiagramWidget extends Component { render() { return ( <div> <Grid container justify="spacebetween" alignItems="center"> <DiagramWidget className="srddemocanvas" diagramEngine={this.props.engine} /> </Grid> </div> ) } } export default FlowDiagramWidget
I want my Redux props in componentWillMount but during exection of the lifecycle method componentWillMount the async prop is empty. The redux props is properly initialized in the constructor.
Whenever I change componentWillMount to componentDidMount I get the following error. Why does this likely happen?
TypeError: Cannot read property 'setMaxNumberPointsPerLink' of null at DiagramWidget.render (main.js:1) at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (ReactCompositeComponent.js:796) at ReactCompositeComponentWrapper._renderValidatedComponent (ReactCompositeComponent.js:819) at ReactCompositeComponentWrapper.performInitialMount (ReactCompositeComponent.js:359) at ReactCompositeComponentWrapper.mountComponent (ReactCompositeComponent.js:255) at Object.mountComponent (ReactReconciler.js:43) at ReactDOMComponent.mountChildren (ReactMultiChild.js:234) at ReactDOMComponent._createInitialChildren (ReactDOMComponent.js:701) at ReactDOMComponent.mountComponent (ReactDOMComponent.js:520) at Object.mountComponent (ReactReconciler.js:43)
Edit: I have this in the parent container:
function mapStateToProps(state, ownProps) { return { flowDiagramData: state.appReducer.flowDiagramData } }

NFA for base m no divisible by n
I was given an exercise to find
DFA for base m no divisible by m
. I found out how to do this, thanks to this link, but then I wondered how would we approach this exercise if it was to create anNFA
and then convert it to DFA using subset construction method.I understand that we can insert
NULL moves
at some place, but I am in search of a straight method, where we convert the problem to NFA seeing only the question. We can also construct a regular expression and the create an NFA, but I can't arrive at a regular expression too.As an example, for creating NFA for numbers given in base 4 that are divisible by 5.
 Convert this from NFA to DFA

Why Doesn't This NFA Accept Empty String?
We were given the definition of a NFA and told to construct an equivalent DFA using the conversion process. I had no issues, however, our professor kept telling us after the assignment that original NFA didn't accept the empty string. I'm a bit confused as to why it doesn't.
Here is the NFA:
δ(q0, a) = {q0, q1} δ(q1, b) = {q1, q2} δ(q2, a) = {q2} δ(q0, λ) = {q2} with initial state q0 and final state q2
Why is the empty string not accepted by the NFA or equivalent DFA? The last rule states that if encountering the lambda while in q0, to go to state q2, which is a final state. I was under the impression that if we accepted the empty string, the machine would both stay in state q0 and transition to q2 and since one of those is a final state, it would be accepted.