I am confused about how best to design this algorithm. A ship has x pirates, where the age of the jth pirate is aj and the weight of the jth pirate is wj. I am thinking of a dynamic programming algorithm, which will find the oldest pirate whose weight is in between twenty-fifth and seventy-fifth percentile of all pirates. But I am cluele...
How would I print the multiples of a list of given numbers in a merged, sorted list?
I.e.
take 10 (multiples [4,5])
gives
4,5,8,10,12,15,16,20,24,25
I've got it working for lists of size 2 or 1 but I need a more general solution :)
...
Let's say I have a set of keywords in an array {"olympics", "sports tennis best", "tennis", "tennis rules"}
I then have a large list (up to 50 at a time) of strings (or actually tweets), so they are a max of 140 characters.
I want to look at each string and see what keywords are present there. In the case where a keyword is composed o...
Hello. I'm writing an algorithm for finding the second min cost spanning tree. my idea was as follows:
Use kruskals to find lowest MST.
Delete the lowest cost edge of the MST.
Run kruskals again on the entire graph.
return the new MST.
My question is: Will this work? Is there a better way perhaps to do this?
...
Hi,
I've got a huge graph with typed edge (i.e. edge with a type property). Say
typedef adjacency_list<vecS, vecS, vertex_prop, edge_prop> Graph;
The "type" of the edge is a member of edge_prop and has a value in {A,B,C,D},
I'd like to run the breadth first search algorithm considering only edges of type A or B.
How would you do ...
Hopefully there are some computational geometry folks here who can help me out with the following problem -
Please imagine that I take a freely moving ball in 3-space and create a 'cage' around it by defining a set of impassible coordinates, Sc (i.e. points in 3-space that no part of the diffusing ball is allowed to overlap). These poi...
How are algorithms analyzed? What makes quicksort have an O(n^2) worst-case performance while merge sort has an O(n log(n)) worst-case performance?
...
I have 10 boxes, each box can hold one item from a group/type of items, each 'group' type only fits in one of the 10 box types. The item pool can have n number of items. The groups have completely distinct items. Each item has a price, i want an algorithm that will generate all the different possibilities, so i can figure out different p...
I'm maintaining a web application which deals with some kind of subscriptions. Users can to renew their subscriptions from 2 months before expiry (not earlier than that). Sometimes user does not renew before expiry and get grace period which is of 3 months. Now he can renew in these 3 months of grace period.
Now the problem part. In th...
Hi, I was wondering if this rope bridge problem could be solved with a graphing algorithm search:
My gut feeling says DFS but how should I define the states? (That is if DFS is even the way to go.)
Rope Bridge
...
..here my problem is i should check whether the speed ranges overlap or not and if they overlap i should display a message saying the speed ranges cannot be overlapped.
Minimum Maximum Rate
1 15 10
16 25 15
...
I have a large number of user IDs (integers), potentially millions. These users all belong to various groups (sets of integers), such that there are on the order of 10 million groups.
To simplify my example and get to the essence of it, let's assume that all groups contain 20 user IDs.
I want to find all pairs of integer sets that hav...
I have a list of incomplete ordered numbers. I want to find a particular number with as few steps as possible.
Are there any improvements on this algorithm, I assume you can count the set size without difficulty - it will be stored and updated every time a new item is added.
Your object is to get your cursor over the value x
The first...
Hello, I would like to analyse trajectory data based on given templates.
I need to stack similar trajectories together.
The data is a set of coordinates (xy, xy, xy) and the templates are again lines defined by the set of control points.
I don't know to what direction to go, maybe to Neural Networks or pattern recognition?
Could you p...
I have a friend that is starting up a new project. He wants to be able to use some sort of OCR in order to detect and translate Kanji symbols into other languages. He has hit a bit of a brick wall in finding available algorithms in order to do so, since these symbols are a bit more complex than the English characters that we're used to...
EXAMPLE :if i add a range {1,10}
and another range{15,20}
i should get a message saying the ranges from 11 to 14 are missing.
...
This is a question on combinatorics from a non-mathematician, so please try to bear with me!
Given an array of n distinct characters, I want to generate subsets of k characters in a minimal-change order, i.e. an order in which generation i+1 contains exactly one character that was not in generation i. That's not too hard in itself. Howe...
Hi
I wonder how can I implement the STL map sorting by value.
For example, I have a map m
map<int, int>;
m[1] = 10;
m[2] = 5;
m[4] = 6;
m[6] = 1;
and then.. I'd like to sort that with the m's value.
So, if I print the map, I'd like to get the result like
m[6] = 1
m[2] = 5
m[4] = 6
m[1] = 10
this.
How can I sort like this way?
Is...
When does pruning stop being efficient in a depth-first search? I've been working on an efficient method to solve the N-Queens problem and I'm looking at pruning for the first time. I've implemented it for the first two rows, but when does it stop being efficient? How far should I prune to?
...
I have a set of X items such as {blower, mower, stove} and each item has a certain percentage of times it should be selected from the overall set {blower=25%,mower=25%,stove=75%} along with a certain distribution that these items should follow (blower should be selected more at the beginning of selection and stove more at the end). We ar...