yeah! Second midterm result comes out, and I am happy about my mark. But I just have one little question about the last question on the test. It asks you to change the function so that it will take less time to complete the funcion. So I changed the last line of the loop, the multiplying the same thing twice to a "^2", or "**2" for computer language. I got the question right but it got me thinking, we are using the built-in function pow when we do "**2", then can we just change the whole function to one statement by passing the parameters into the built-in function. If not, then I think I have done something wrong for this question, which i think a better answer will be changing the last line to a pow(pow(),2), which also takes up a constant time as the base. But anyways...midterm was good.
Today, Danny talked about the automata and languages. During lecture, I lost my focus by the midterm.....after reading the slides on my own, I think it is pretty much the same as the patterns I have learned in CSC207, or regular expression.
The "state table" (in the slide, and I dont know what it is called) was hard to understand at first, since I dont know what the value goes in there are, but the DFSA really helps. the value inside the table means that if the state reads an input, what should it bring it to(one of the states). Then we talked about L, the language in English, and L(R), the regular expression. I find it inconvenient and confusing to use L for both cases.
Also, I think the proving techniques have nothing to do with creating the DFSA. It is just like writing a program, we have to think about each cases, and deal with them. Some cases have the same result, in which we put them into the same statement. I think it is just a matter of thinking(of course!), and in the exam, if you want to finish this kind of question really fast, you will have to do lots of samples before hand.
No comments:
Post a Comment