computer-science

Does order not matter in regular expressions?

余生长醉 提交于 2019-12-23 16:11:59
问题 I was looking at the question posed in this stackoverflow link (Regular expression for odd number of a's) for which it is asked to find the regular expression for strings that have odd number of a over Σ = {a,b} . The answer given by the top comment which works is b*(ab*ab*)*ab* . I am quite confused - a was placed just before the last b* , does this ordering actually matter? Why can't it be b*a(ab*ab*)*b* instead (where a is placed after the first b* ), or any other permutation of it?

Why is the complement of a regular language still a regular language?

橙三吉。 提交于 2019-12-23 12:45:17
问题 According to my textbook, the complement of L1 = A* - L1 is a regular language as long as L1 is a regular language. Doesn't A* also include Context Free languages, Context Sensitive languages, and Recursively Enumerable languages? A*-L1 would include all of them too, wouldn't it? How can it be regular then? Under the representation of a Finite State Machine I understand why the complement is still a regular language. However, I can't understand the theory behind it. Also, A* - L1 = A*

should we teach pointers in a “fundamentals of programming” course?

空扰寡人 提交于 2019-12-23 10:55:13
问题 I will be teaching a course on the fundamentals of programming next Fall, first year computer science course. What are the pros and cons of teaching pointers in such a course? (My position: they should be taught). Edit: My problem with the "cater your audience" argument is that in the first couple of years in University, we (profs) do not know if students would like to be scientists or not... we wish we knew, but we have to strike a balance between those who will remain in school (4 years

database refinement - minimal cover of F (extraneous attributes)

夙愿已清 提交于 2019-12-23 10:21:37
问题 Schema R = (A, B, C, D, E, F) FD F = {ABC -> D, CD -> B, BCF -> D, CDF -> BE, BCDF -> E} Find Fc, the minimal cover (aka. canonical cover) of F. This is the method using in my book: Example: abc -> xyz a is redundant (extraneous) if (bc)+ ⊇ a; x is redundant if (abc)+ ⊇ x. NOTE: Here, the closures are computed using F, with a or x being deleted from abc -> xyz respectively. I don't understand the last bold sentence. one solution is: Consider CDF -> BE B is redundant: (CDF)+ = (CDFBE) ⊇ ( B )

Data structure for large ranges of consecutive integers?

余生长醉 提交于 2019-12-23 09:34:39
问题 Suppose you have a large range of consecutive integers in memory, each of which belongs to exactly one category. Two operations must be O(log n): moving a range from one category to another, and finding the category counts for a given range. I'm pretty sure the second operation is solved trivially given a correct implementation for the first operation. Each integer begins in a category, so I started with a set of balanced BSTs. Moving a subtree from one BST to another (eg, moving a range to a

“data bit” capacity vs “overhead bit” size?

邮差的信 提交于 2019-12-23 07:55:23
问题 I am a little stuck because I cannot find anything which covers the "data" part of the cache, everything that I have googled deals 99.9% with the addressing of cache. The question I was asked is worded as such Contrast the difference between "data bit" capacity and "overhead bit" size for the two caches. I don't want the answer so I am not going to post the actual set sizes and what not, I am just looking for a direction to maybe a website or an explanation of how to "contrast" the two. Any

Algorithm in C to calculate coefficients of polynomial using Lagrange interpolation

半城伤御伤魂 提交于 2019-12-23 04:42:29
问题 I've been stuck on this for a while now. I'm writing an algorithm in C to pull out the coefficients of a polynomial using Lagrange's interpolation method. My code partially works, for instance if we do the first example here http://en.wikipedia.org/wiki/Lagrange_polynomial#Example_1 then the code can print out the first 2 coefficients (0 and 4.834848) Similarly with example 3 on that article, it will print the 2 coefficients 6 and -11. I need to be able to accurately get all the coefficients

How beneficial is this subject combination for an undergrad CS student?

寵の児 提交于 2019-12-22 12:48:33
问题 I'm an undergrad Computer Science student and studying online. There is a lot of self study, independent research and practice i have to do myself. I wonder how beneficial would it be to choose this subject combination in programming: Data Structures OOP Assembly Language & Computer Architecture Although i also have the option to take DLD (Digital Logic Design) or Data communication courses instead of Assembly Language. My interest lies in programming and i'm also working as a programmer at

What does this x86-64 addq instruction mean, which only have one operand? (From CSAPP book 3rd Edition)

让人想犯罪 __ 提交于 2019-12-22 11:14:10
问题 In the following instructions, how does the addq work? It only has one operand, the book claims that it increments %rdx, but %rdx is not in this instruction. I am so confused... This is from the book Computer Systems A Programmers Perspective, 3rd Edition. 回答1: As @Jester pointed out in the comment. It is indeed an error. I actually typed in the program and compiled it using gcc on linux. Below is the results. C program: badcnt.c /* * badcnt.c - An improperly synchronized counter program */

Password Hashing

别等时光非礼了梦想. 提交于 2019-12-22 09:13:09
问题 I am creating a web application which stores users passwords. I was wondering what are the best methods / algorithms that a programmer can use to hash passwords? 回答1: Key strengthening techniques such as bcrypt or PBKDF2 are generally considered better than plain hashes since cracking them requires more resources. The downside of this is that generating and verifying them also requires more resources; your resources. Regardless of exactly which algorithm you choose, always use a suitable, per