theory

Efficiently finding the intersection of a variable number of sets of strings

只谈情不闲聊 提交于 2019-11-26 09:02:53
问题 I have a variable number of ArrayList\'s that I need to find the intersection of. A realistic cap on the number of sets of strings is probably around 35 but could be more. I don\'t want any code, just ideas on what could be efficient. I have an implementation that I\'m about to start coding but want to hear some other ideas. Currently, just thinking about my solution, it looks like I should have an asymptotic run-time of Θ(n 2 ). Thanks for any help! tshred Edit: To clarify, I really just

Is the C99 preprocessor Turing complete?

感情迁移 提交于 2019-11-26 08:00:30
问题 After discovering the Boost preprocessor\'s capabilities I found myself wondering: Is the C99 preprocessor Turing complete? If not, what does it lack to not qualify? 回答1: Here is an example of abusing the preprocessor to implement a Turing machine. Note that an external build script is needed to feed the preprocessor's output back into its input, so the preprocessor in and of itself isn't Turing complete. Still, it's an interesting project. From the description of the afore-linked project:

What good are SQL Server schemas?

若如初见. 提交于 2019-11-26 06:58:13
问题 I\'m no beginner to using SQL databases, and in particular SQL Server. However, I\'ve been primarily a SQL 2000 guy and I\'ve always been confused by schemas in 2005+. Yes, I know the basic definition of a schema, but what are they really used for in a typical SQL Server deployment? I\'ve always just used the default schema. Why would I want to create specialized schemas? Why would I assign any of the built-in schemas? EDIT: To clarify, I guess I\'m looking for the benefits of schemas. If you

What is Turing Complete?

人走茶凉 提交于 2019-11-26 06:04:21
问题 What does the expression \"Turing Complete\" mean? Can you give a simple explanation, without going into too many theoretical details? 回答1: Here's the briefest explanation: A Turing Complete system means a system in which a program can be written that will find an answer (although with no guarantees regarding runtime or memory). So, if somebody says "my new thing is Turing Complete" that means in principle (although often not in practice) it could be used to solve any computation problem.

How to test randomness (case in point - Shuffling)

放肆的年华 提交于 2019-11-26 05:27:42
问题 First off, this question is ripped out from this question. I did it because I think this part is bigger than a sub-part of a longer question. If it offends, please pardon me. Assume that you have a algorithm that generates randomness. Now how do you test it? Or to be more direct - Assume you have an algorithm that shuffles a deck of cards, how do you test that it\'s a perfectly random algorithm? To add some theory to the problem - A deck of cards can be shuffled in 52! (52 factorial)

What is referential transparency?

这一生的挚爱 提交于 2019-11-26 04:56:38
问题 What does the term referential transparency mean? I\'ve heard it described as \"it means you can replace equals with equals\" but this seems like an inadequate explanation. 回答1: The term "referential transparency" comes from analytical philosophy, the branch of philosophy that analyzes natural language constructs, statements and arguments based on the methods of logic and mathematics. In other words, it is the closest subject outside computer science to what we call programming language

Are there any O(1/n) algorithms?

随声附和 提交于 2019-11-26 02:59:43
问题 Are there any O(1/n) algorithms? Or anything else which is less than O(1)? 回答1: This question isn't as stupid as it might seem. At least theoretically, something such as O (1/ n ) is completely sensible when we take the mathematical definition of the Big O notation: Now you can easily substitute g ( x ) for 1/ x … it's obvious that the above definition still holds for some f . For the purpose of estimating asymptotic run-time growth, this is less viable … a meaningful algorithm cannot get

Why are Redirect Results not allowed in Child Actions in Asp.net MVC 2

巧了我就是萌 提交于 2019-11-26 02:37:54
问题 I have some partial actions that I render with the Asp.Net Futures RenderAction method. Some of these perform redirects after the forms in them have been processed. Now that I upgraded to Asp.Net MVC 2 RC it gives me an error \"Child actions are not allowed to perform redirect actions\". I checked out the source code and I found the line that throws the exception. To Get around it I can make a custom RedirectResult, But before I do I want to understand why the framework doesn\'t allow it in

What is a Y-combinator? [closed]

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-26 02:25:49
问题 A Y-combinator is a computer science concept from the “functional” side of things. Most programmers don\'t know much at all about combinators, if they\'ve even heard about them. What is a Y-combinator? How do combinators work? What are they good for? Are they useful in procedural languages? 回答1: If you're ready for a long read, Mike Vanier has a great explanation. Long story short, it allows you to implement recursion in a language that doesn't necessarily support it natively. 回答2: A Y

What is the point of interfaces in PHP?

此生再无相见时 提交于 2019-11-26 01:50:57
问题 Interfaces allow you to create code which defines the methods of classes that implement it. You cannot however add any code to those methods. Abstract classes allow you to do the same thing, along with adding code to the method. Now if you can achieve the same goal with abstract classes, why do we even need the concept of interfaces? I\'ve been told that it has to do with OO theory from C++ to Java, which is what PHP\'s OO stuff is based on. Is the concept useful in Java but not in PHP? Is it