It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm looking for a list of problems (the more the problems the better) with their corresponding algorithm technique(s) these problems can be solved.
For example:
Shortest Path problem -> Dijkstra's algorithm (dynamic programming), and maybe others ...
Knapsack problem -> can be solved with dynamic programming, ...
Convex Hull problem -> could be done by divide and conquer, ...
If in every problem there is a small paragraph explaining how the problem is solved (e.g. it could explain how to "divide" the problem in a divide and conquer algorithm) with the given
technique that would be even better.
Is there any such list available in the net or in a book?
*UPDATE after locking ... *
I'm not looking for problems mostly found in programming contests like TopCoder. Problems from such sites (contests) use to "hide" the problem definition which is supposed to be found by the user. I'm looking for problem definitions, like Given a graph G = (V, E) ... and it's given solution technique Could be solved using divide and conquer ... instead of problems definitions like this: Given N houses, John tries to find a path to go home as fast as possible ... which are how problems are described in programming contests sites.
This question has nothing to do with homework as some people thought. I want to "exercise" my algorithm solution technique skills. By knowing that a given problem can be solved by a given technique will help me try to find a solution using this technique and so I guess will get a deeper understanding of each technique, plus I will be become a better algorithm solver.
The site Algorithmist categories many problems (but not all) from UVa online judge and Sphere Online Judge. For example, here is the partial category listing for UVa Volume I. Also check their Categories page.
Topcoder categorizes each problem from every past contest they held. Besides that, you can filter problems by difficulty, as well as read editorials or other people's solutions.
Related
This question already has answers here:
Algorithm for solving Flow Free Game
(6 answers)
Closed 7 years ago.
I'm looking to create a program to perform a puzzle for me in a similar fashion as this one. I have completed the piece searching portion to identify each of the pieces but I'm stuck at where to being to start solving the puzzle.
Backtracking is an option but for very large board sizes it will have high complexity and take time.
Is there any suitable algorithm to solve the game efficiently. Can using heuristics to solve the board help?
Looking for a direction to start.
It's hard to understand the precise logic of the game you posted. However, if you want something more efficient than DFS/BFS, then you should take a look at A* star: http://theory.stanford.edu/~amitp/GameProgramming/
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
What is an efficient algorithm in C or python that, given a list of unordered pairs signifying a relationship between two numbers, will combine the pairs so that they form a continuous list.
For example, given the following:
(0, 1)
(1, 2)
(3, 2)
(4, 3)
produce the following: [0, 1, 2, 3, 4]
Obviously, this would not work where there are gaps or loops in the pairs, e.g., (0, 1) (3, 4), and in those cases, throw an error message or something similar.
The numbers can be modeled as a vertex in a graph. Each element in the list will then represent an edge between the nodes.
What you are looking for is then the 'Eulerian Path' of this graph. There are multiple algorithms for this. Check out the well known algorithms at: http://en.wikipedia.org/wiki/Eulerian_path
What you are trying to do is not an Eulerian path (visiting each edge once) but a Hamiltonian path (visiting each vertex once), because you do not want to have loops in your path which by the definition of a loop means you don't want to visit any vertex two times.
This problem is known to be NP-complete which means that there is no known efficient algorithms (if by "efficient" you mean in polynomial time).
If you can find an efficient algorithm for this problem, you would also solve the P vs NP problem by showing that P and NP are equal. Most computer scientists believe that the answer to the P vs NP problem is "No, efficient algorithms for NP problems are impossible", which means that there is no possibility of an efficient algorithm to your question (although it remains to be proved).
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I was just reading about it on a book and wikipedia but still dont understand it 100%.
I would really appreciate it if someone could explain it with an example or two.
Thanks
Say I'm looking at a map, searching for a pizza place near my block in the city. A few different strategies I could use:
Breadth first search (BFS): Look at concentric circles of blocks around my block, farther and farther outward until I find a pizza place. This will give me one of the pizza places which is closest to my block as the crow flies.
Depth first search (DFS): Follow a road until I hit a dead end, then backtrack. Eventually all possible branches will be searched, so if there's a pizza place out there somewhere then I'll find it, but it probably won't be very close to my block.
Uniform cost search (UCS): Say traffic is bad on some streets, and I'm really familiar with the city. For any given location I can say how long it will take me to get there from my block. So, looking at the map, first I search all blocks that will take me 1 minute or less to get to. If I still haven't found a pizza place, I search all blocks that will take me between 1 and 2 minutes to get to. I repeat this process until I've found a pizza place. This will give me one of the pizza places which is the closest drive from my block. Just as BFS looks like concentric circles, UFS will looks like a contour map.
Typically you will implement UCS using a priority queue to search nodes in order of least cost.
I assume you were looking at this Wikipedia page. What it means is that the time required for a given operation (adding two numbers, comparing two numbers, retrieving data from memory, etc.) is independent of the size of the variables involved. In other words, an 8-bit comparison takes the same amount of time as a 32-bit comparison. Making this assumption allows you to simplify an efficiency analysis and compare algorithms without getting bogged down in implementation details.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
How we can to fill the chessboard with domino and we have a some blocks. and chessboard is n x m. and the places filled with ordered numbers.
Test :
Answer like this :
input give n , m and k. k is number of blocks.
and next k lines give blocks such as 6 7 or 4 9.
sorry for my English.
Here's an idea. In your example board, it is immediately obvious that squares 7 9 and 14 must contain domino 'ends', that is to say it must be the case that there are dominos covering 2-7, 8-9, and 14-15.
(In case it's not 'immediately obvious', the rule I used is that a square with 'walls' on three sides dictates the orientation of the domino covering that square)
If we place those three dominos, it may then be the case that there are more squares to which the same rule now applies (eg 20).
By iterating this process, we can certainly make progress towards our goal, or alternatively get to a place where we know it can't be achieved.
See how far that gets you.
edit also, note that in your example, the lower-left corner 2x2 (squares 11 12 16 17) is not uniquely determined - a 90 degree rotation of the depicted arrangement would also work - so you will have to consider such situations. If you are looking for any solution, you must come up with a way of arbitrarily picking one of many possibilities; if you are trying to enumerate all possibilities, you will have to come up with a way of finding them all!
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Say you wanted to find which input causes function x to output value y, and you know the (finite) range of possible inputs.
The input and output are both numbers, and positively correlated.
What would be the best way to optimize that?
I'm currently just looping through all of the possible inputs.
Thanks.
One solution would be a binary search over the possible inputs.
Flow:
find the median input x
get the output from function(x)
if the output is less than the desired y
start over using the smaller half of the possible inputs
else
start over using the larger half of the possible inputs
A binary search algorithm, perhaps?
http://en.wikipedia.org/wiki/Binary_search_algorithm
If the range is finite and small, a precomputed lookup table might be the fastest way
if you have some sets of know "x" data that yield "y" you can divied between training and test sets and use neural networks.