I have four objects - for the sake of arguments, let say that they are the following letters:
A B C D
I need to calculate the number of variations that can be made for these under the following two conditions:
No repetition
Objects are position agnostic
Taking the above, this means that with a four object sequence, I can have only o...
(This is a hypothetical question for discussion, I have no actual problem).
Say that I'm making an implementation of SortedSet by extending LinkedHashMap:
class LinkedHashSortedMapThing extends LinkedHashMap implements SortedSet {
...
}
Now programmers who use this class may do
LinkedHashMap x = new LinkedHashSortedMapThing();
Bu...
What is the shortest hash that can be obtained and why? What happens if you try to achieve a shorter one, is there a fixed limit or does it depend on the length of the hashed data and why?
...
I recently learned about normalisation in my informatics class and I'm developing a multiplayer game using SQLite as backend database at the moment.
Some information on it:
The simplified structure looks a bit like the following:
player_id | level | exp | money | inventory
---------------------------------------------------------
...
Do you know a good online tutorial detailing solving graph problems using PHP, I'm also very interested in optimal graph data type representation in PHP (I assume that would be multidimensional arrays)?
I'm talking about mathematical graph theory (yes, vertices and edges). Google spits out loads of stuff, just not the PHP implementation...
I was having a discussion earlier about a state machine, and there was a question as to whether it might not halt on some input. It seems like a property of state machines that is important and frequently mentioned, but I can't for the life of me figure out what the name of that property is. Is there such a term? Is it "haltable", "not...
Is there a way to generate all of the subset sums s1, s2, ..., sk that fall in a range [A,B] faster than O((k+N)*2N/2), where k is the number of sums there are in [A,B]? Note that k is only known after we have enumerated all subset sums within [A,B].
I'm currently using a modified Horowitz-Sahni algorithm. For example, I first call it t...
To preface this, my knowledge of this kind of stuff is puny.
Anyways, I've been developing a context-free grammar to describe the structure of alegbraic expressions so I can teach myself how the CYK parsing algorithm works. I understand how such a structure can work with only infix algebraic expressions, but I cannot understand how to d...
I know for sure that this is a simple directed graph. But I cannot say that this is a ring graph/network, because node 3 has a degree of 4. But as I imagine this, you cannot go to node 7 from node 3 if the preceding node is node 2, and you cannot go to node 4 from node 3 if the preceding node is node 6. That means the only way to travers...
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?
...
Let's say I have color 'FOO', and it is stored in RGB format. I need to recolor 'FOO' so it matches the closest color in a list of colors. Doing this on the fly, couldn't I view the RGB values from each color as points on a 3D grid (r=x, g=y, b=z) and compute the distance between point 'FOO' vs the points from each color in the list?
...
Feel free to correct me if any part of my understanding is wrong.
My understanding is that GPUs offer a subset of the instructions that a normal CPU provides but executes them much faster.
I know there are ways to utilize GPU cycles for non-graphical purpose, but it seems like (in theory) a language that's Just In Time compiled could d...
As I'm always dissatisfied with existing editors, a project I always wanted to start is my own text editor. However doing text editing is serious business.
Besides analyzing the source code of existing text editors, is there any book or other resource (like academic work) about this topic? I'm interested especially in something that tea...
I am taking a principals of programming class right now.
We are learning about LL(1) grammars.
I found the book and lectures to be somewhat unclear and was hoping that someone could refer me to a good resource.
I found some good youtube tutorials for finate state automatons and determinate state automatons, but I cannot find any...
Christoph Koutschan has set up an interesting survey that tries to identify the most important algorithms "in the world". Since one of the criteria is that "the algorithm has to be widely used" I though that extending the survey to the huge group of users at Stack Overflow would be a natural thing to do.
So, what do you think? Which alg...
So given the following program:
Is the time complexity of this program O(0)? In other words, is 0 O(0)?
I thought answering this in a separate question would shed some light on this question.
EDIT: Lots of good answers here! We all agree that 0 is O(1). The question is, is 0 O(0) as well?
...
What is the most elegant way to grab unique random numbers I ponder?
At the moment I need random unique numbers, I check to see if it's not unique by using a while loop to see if I've used the random number before.
So It looks like:
int n = getRandomNumber % [Array Size];
for each ( Previously used n in list)
Check if I've used n...
hi
im facing the challange of optimizing a database design by an automated mechanism.
the database will include tables which relates arbitrary data to an attribute
e.g. Table A contains all id's of persons who clicked the buy button, Table B contains all id's who have no chargeback, ....
so given are some very basic MainTables e.g. A,B...
Playing around with regular expressions, especially the balanced matching of the .NET flavor, I came to a point where I realized that I do not understand the inner workings of the engine as good as I thought I did. I'd appriciate any input on why my patterns behave the way they do! But fist...
Disclaimer: This question is purely theoret...
When I read about different computing languages on here, I always wonder what motivated the original decision to develop something new instead of just extending a language which already exists.
Question: How does someone go about 'designing' a new programming language and how do they decide objectively which choices to make?
If there a...