algorithm

Combinations of Multiple Vector's Elements Without Repetition

Hi, I have n amount of vectors, say 3, and they have n amount of elements (not necessarily the same amount). I need to choose x amount of combinations between them. Like choose 2 from vectors[n]. Example: std::vector<int> v1(3), v2(5), v3(2); There cannot be combinations from one vector itself, like v1[0] and v1[1]. How can I do this...

Trying to learn about SCM history/revision/restore algorithms, especially GIT

Hi - I'm trying to dig up resources on how version control algorithms operate on data, and I'm especially interested in the way git's mechanism operates. I realize git does many different things, but in particular I'm interested in how history is saved and restored. I'd appreciate any links or article references anyone can point me to. ...

Modeling distribution of performance measurements

How would you mathematically model the distribution of repeated real life performance measurements - "Real life" meaning you are not just looping over the code in question, but it is just a short snippet within a large application running in a typical user scenario? My experience shows that you usually have a peak around the average exe...

Pagerank vs SVD

Pagerank works on the nodegraph of a series of pages and the directed edges formed by their respective inward and outward links. Thus the rank of a particular page is broadly a locally-induced effect in the nodegraph. SVD, on the other hand, works on a whole matrix of values, and has no directionality - a link between site A and site B ...

TicTacToe AI Making Incorrect Decisions

A little background: as a way to learn multinode trees in C++, I decided to generate all possible TicTacToe boards and store them in a tree such that the branch beginning at a node are all boards that can follow from that node, and the children of a node are boards that follow in one move. After that, I thought it would be fun to write ...

How Fast would a SQLite join be compared to a custom tree search?

Continuing some themes in this question, I would like to know if I could get a performance of O(log n) on the size of the table from somes sqlite queries. The first would get the mth element of a table ordered by weight: select id, weight from items order by weight limit 1 offset m The second would do the opposite, get mth position o...

Resizing Columns Algorithm

I have a set of columns of varying widths and I need an algorithm to re-size them for some value y which is greater than the sum of all their widths. I would like the algorithm to prioritize equalizing the widths. So if I have a value that's absolutely huge the columns will end up with more or less the same width. If there isn't enough ...

How to Get a Quantitative Comparison of Two Signals

I’m trying to implement a Blind Source Separation (BSS) algorithm and I’m running into trouble determining the efficacy of the algorithm. I’m trying to create test cases where I work backwards and start with a signal vector s, which is normally unknown, and then create a mixing matrix A, which I use to transform s to create the observa...

How to write a binary algorithm for C/C++

I am having trouble to write the binary algorithm in C/C++. My question is like that: Apply binary algorithm to search for a number from 1 to 100 in a number guessing game. The user will respond with 'y' for a correct guess, 'h' if the guess is too high or 'l' if the guess is too low. I don't have any idea to apply it. Can someone ju...

how to design CPM algorithm ?

Hi how to represent a graph with list data structure i have three class (Graph, Node, Edge) and would like to find the critical path in graph. how to calculate ES : Earliest Start EC : Earliest Complete LS : Latest Start LC : Latest Complete thanks ...

STRIPS planning question: How do you detect interacting subgoals?

I'm trying to learn how a depth-first search STRIPS algorithm knows how to detect interacting subgoals. Here is an instance that confuses me. This is a powerpoint slide given to me by my professor, but I'm not sure how he's reaching the conclusion of an interacting subgoal. The problem at hand is the very traditional A,B,C block scheme ...

How can you compare sets of numbers and get the most relevant results using MySQL and PHP?

Consider this: set A: 1 2 3 4 set B: 3 4 5 6 set C: 4 5 6 7 set D: 1 I want to compare D with the rest and get as a result a set of numbers as most relevant. The result should be in this order: 4 (as D has a common number with A and 4 is in A and also in B and C), 3 (as D has a common number with A and 3 is in A and B), 2 (...

Is it possible to generate Pangram from given word list?

Pangram is a sentence using every letter of the alphabet at least once. Is it possible to generate shortest Pangram from given word list? Lets say, I have word list like this cat monkey temp banana christmas fast quick quickest jumping white brown black blue fox xor jump jumps oven over now the is was lazy laziest crazy dig dog jo...

Is it possible to write a program that extracts a specific melody/beat/rhythm from a specific instument from a mixed wave (or other music format) file?

Is it possible to write a program that can extract a melody/beat/rhythm provided by a specific instument in a wave (or other music format) file made up of multiple instruments? Which algorithms could be used for this and what programming language would be best suited to it? ...

Homework: binary tree - level-order trasversal

hi, is there a way to visit a binary tree from the lowest level to the higher (root) ? not from the root-level to the lowest!!! (and not using the level-order traversal and a stack...!!!) <--- its opposite.. so difficult...thank you! ...

error correcting codes aimed at slow CPUs transmitting to fast CPUs

I'm looking for a forward error-correcting code that is relatively easy/fast to encode on a microcontroller; decode will be done on a PC so it can be more complicated. I don't know that much about error-correcting codes and except for the simple Hamming codes they seem to all be more complicated than I can handle. Any recommendations? ...

prefix to infix on stack

I'm trying to implement prefix to infix in c++, that's what i've got so far. The input should be for example something like this: /7+23 And the ouput: 7/(2+3) or (7/(2+3)) But instead I get: (/) That's the code I wrote so far: void pre_to_in(stack<char> eq) { if(nowe.empty() != true) { char test; test = eq.top();...

XML to Datamodel synchronisation strategies...

I have an XML data source, which I'm loading / refreshing. I'm populating a data model from this source and would like to manage synchronisation issues e.g. being able to notify the GUI/User when items have been removed, had their values increased / decreased, changed... etc. I'm wondering if there is a standard way of doing this? I...

Encryption algorithms...

Would someone recommend a good book on data encryption algorithms? I would like one that has the math theory as well as some code examples. ...

How to implement AI for Puyo Puyo game?

Can someone give me some pointers on how I should implement the artificial intelligence (human vs. computer gameplay) for a Puyo Puyo game? Is this project even worth pursuing? The point of the game is to form chains of 4 or more beans of the same color that trigger other chains. The longer your chain is, the more points you get. My de...