what is the Floyd Warshall algorithm?
85041
In computer science, the Floyd-Warshall algorithm (sometimes known as the Roy-Floyd algorithm or Warshall's algorithm) is an algorithm for solving the all-pairs shortest path problem on weighted, directed graphs in cubic time.\n\nThe Floyd–Warshall algorithm takes as input an adjacency matrix representation of a weighted, directed graph (V, E). The weight of a path between two vertices is the sum of the weights of the edges along that path. The edges E of the graph may have negative weights, but the graph must not have any negative weight cycles. The algorithm computes, for each pair of vertices, the minimum weight among all paths between the two vertices. The running time complexity is Θ(|V|3).\n\nThe algorithm is based on the following observation: Assuming the vertices of a directed graph G are V = {1, 2, 3, 4, ..., n}, consider a subset {1, 2, 3, ..., k}. For any pair of vertices i, j in V, consider all paths from i to j whose intermediate vertices are all taken from {1, 2, ..., k}, and p is a minimum weight path from among them. The algorithm exploits a relationship between path p and shortest paths from i to j with all intermediate vertices in the set {1, 2, ..., k−1}. The relationship depends on whether or not k is an intermediate vertex of path p.\n\nhttp://en.wikipedia.org/wiki/Floyd-Warshall_algorithm
427298
And what is this question about?\n\nFor example, external sorting algorythms was described quite thoroughly in vol.3 of "The Art of Computing Programming" written by Donald Knuth.\n\nIs that enough?
334220
The Viterbi algorithm is a dynamic programming algorithm for finding the most likely sequence of hidden states – known as the Viterbi path – that result in a sequence of observed events, especially in the context of hidden Markov models. The forward algorithm is a closely related algorithm for computing the probability of a sequence of observed events. These algorithms form a subset of information theory.\n\nHere's an example:\n\nAssume you have a friend who lives far away and whom you call daily to talk about what each of you did that day. Your friend has only three things he's interested in: walking in the park, shopping, and cleaning his apartment. The choice of what to do is determined exclusively by the weather on a given day. You have no definite information about the weather where your friend lives, but you know general trends. Based on what he tells you he did each day, you try to guess what the weather must have been like.\n\nYou believe that the weather operates as a discrete Markov chain. There are two states, "Rainy" and "Sunny", but you cannot observe them directly, that is, they are hidden from you. On each day, there is a certain chance that your friend will perform one of the following activities, depending on the weather: "walk", "shop", or "clean". Since your friend tells you about his activities, those are the observations. The entire system is that of a hidden Markov model (HMM).\n\nYou know the general weather trends in the area and you know what your friend likes to do on average. In other words, the parameters of the HMM are known. In fact, you can write them down in the Python programming language:\n\nstates = ('Rainy', 'Sunny')\n\nobservations = ('walk', 'shop', 'clean')\n\nstart_probability = {'Rainy': 0.6, 'Sunny': 0.4}\n\ntransition_probability = {\n   'Rainy' : {'Rainy': 0.7, 'Sunny': 0.3},\n   'Sunny' : {'Rainy': 0.4, 'Sunny': 0.6},\n   }\n\nemission_probability = {\n   'Rainy' : {'walk': 0.1, 'shop': 0.4, 'clean': 0.5},\n   'Sunny' : {'walk': 0.6, 'shop': 0.3, 'clean': 0.1},\n   }\n\nIn this fragment, start_probability refers to your uncertainty about which state the HMM is in when your friend first calls you (all you know is that it tends to be rainy on average). The particular probability distribution used here is not the equilibrium one, which is (given the transition probabilities) actually approximately {'Rainy': 0.571, 'Sunny': 0.429}. The transition_probability refers to the change of the weather in the underlying Markov chain. In this example, there is only a 30% chance that tomorrow will be sunny if today is rainy. The emission_probability tells you how likely your friend is to perform a certain activity on each day. If it's rainy, there is a 50% chance that he is cleaning his apartment; if it's sunny, there is a 60% chance that he will go outside for a walk.\n\nYou talk to your friend three days in a row and discover that on the first day he went for a walk, on the second day he went shopping, and on the third day he cleaned his apartment. You have two questions: What is the overall probability of this sequence of observations? And what is the most likely sequence of rainy/sunny days that would explain these observations? The first question is answered by the forward algorithm; the second question is answered by the Viterbi algorithm. These two algorithms are structurally so similar (in fact, they are both instances of the same abstract algorithm) that they can be implemented in a single function:\n\ndef forward_viterbi(y, X, sp, tp, ep):\n   T = {}\n   for state in X:\n       ##          prob.      V. path  V. prob.\n       T[state] = (sp[state], [state], sp[state])\n   for output in y:\n       U = {}\n       for next_state in X:\n
333863
Diagonalisation is the answer here.  Not sure how this didn't turn up in a web search, as I found plenty of resources for it, but the idea is that you find a matrix that diagonalises your initial matrix, and this allows powers to be done trivially.\n\nAssuming you're aiming to get a matrix A to the power n:\n\nFind P such that:\nP^-1 A P = D, where D is diagonal.  Then:\nA = (P D P^-1) and:\nA^n = (P D P^-1)(P D P^-1)(P D P^-1)....\n\nThe P^-1 P terms cancel and you're left with:\nA^n = P D^n P^-1\n\n... and this is much easier to calculate as D^n is trivial :)\n\nA good reference is in the sources.  Hope that helps!
359570
Browse some of these links for ideas, algorithm descriptions, etc., in the comments.\n\n\nhttp://www.google.com/search?q=%22histogram+equalization%22+%22source+code%22+C%2B%2B
410291
http://en.wikipedia.org/wiki/Permutation
725218
Modified Gram-Schmidt algorithm\n------------------- -----------------------\nA  is m x n,  with m ≥ n  s.t. rank(A) = n\n\n(a) For i = 1, ... , n \n`````````w_i = a_i\nEnd (a) For\n(b) For i = 1, ... , n\n`````````r_ii = ||w_i||\n`````````q_i = (w_i)/(r_ii)\n`````````(c) For j = i + 1, ... , n\n``````````````````r_ij = <q_i, w_j>\n``````````````````w_j = w_j - (r_ij)(q_i)\n`````````End (c) For\nEnd (b) For
958876
A simple algorithm is to first take all n(n-1)/2 pairs of points. Each pair defines a line, count how many of the remaining points lie on the line. This will be a cubic algorithm in n, the number of points.\n\nA clever algorithm using sorting takes time O( n^2 log n). See the Sources.
244607
reverse( NewString.begin(), NewString.end() );\n\n(You will have to #include <algorithm> )
350177
Sometimes adding some indents will help figure out what's going on.  In your algorithm, you have a lot of nested if and while statements, so space them out like this first to see how each is related to each other (I'm using periods because Yahoo won't show spaces):\n\ni <- 0\nwhile (i < n) do\n...j <- i+1\n...m <- a[i]\n...while (j < n) do\n......if (m > a[j]) then\n.........m <- a[j]\n......end if\n......j <- j + 1\n...end while\n...b[i] <- m\n...i <- i + 1\nend while\n\nYour i is a counter that starts with 0, and your j is a counter that starts with 1.  j will always be more than i.\n\nThe "while (i < n) do" line limits this algorithm to 3 loops, since n is 3.\n\nDirectly after this statement, j is established as a counter, and m is defined to be the i-th element of your matrix.  The next while statement then compares m (the i-th element in the matrix) to the element after this (using j to read the next element).\n\nIf m is larger, then the if statement makes m take on the smaller value.  If m is smaller, nothing happens and j is indexed to the next value.  Then the process repeats itself.  If we get to the end of the matrix and m isn't replaced anymore, it becomes the i-th value in matrix B.  After this, i is indexed to the next element in matrix A and the entire process is repeated once again, until all of matrix A has been checked.\n\nThe result then is that through m, matrix A is sorted least to greatest and is written into matrix B, which is answer (d).
509584
Dark Side of the Moon - Pink Floyd
1140444
$ Money $ - Pink Floyd
219213
So you need to find a lower diagonal matrix L and an upper diagonal matrix U such that L*U equals the given matrix. The most straightforward way of doing this is to perform Gaussian elimination while keeping track of all the row operations you perform. The row operations are used to construct the matrix L, and the end product of the Gaussian elimination will be U.\n\nStart with the 1 in the top left corner and use it to eliminate all the non-zero terms below it. So take twice the first row and subtract it from the second row, giving you:\n1 1 1\n0 0 0\n3 3 3\n\nWhile you are doing this you should keep track of a matrix that will undo all the operations you have done (this will be your L matrix in the end). Start with the identity matrix and add a 2 in the first column of the second row (it's a +2 since we subtracted twice the first row but we are looking for a matrix that will undo all the operations we are performing and get us back to the original matrix)\n1 0 0\n2 1 0\n0 0 1\n\nNow eliminate the 3 in the bottom left corner by taking the third row and subtracting 3 times the first row, giving you:\n\n1 1 1\n0 0 0\n0 0 0\nwhich is upper triangular (so it'll be your U) and an L matrix:\n1 0 0\n2 1 0\n3 0 1\nwhich is lower triangular. You can confirm that L*U does in fact equal your original matrix, so you're done.
1159892
Sequential search:\n\nhttp://cprogramming.com/discussionarticles/sorting_and_searching.html
437960
why not try Danube's Enigma, it is easy and fulfills the requirements of all matlab projects!\n:)
651564
hemidemisemiquaver\n\nhttp://en.wikipedia.org/wiki/Musical_notation
878309
Diamond-Square is a great height-map generation algorithm. It's kind of cool that something that simple could create realistic landscapes.