Search Results

Search found 5079 results on 204 pages for 'bankers algorithm'.

Page 10/204 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • A leader election algorithm for an oriented hypercube

    - by mick
    I'm stuck with some problem where I have to design a leader election algorithm for an oriented hypercube. This should be done by using a tournament with a number of rounds equal to the dimension D of the hypercube. In each stage d, with 1 <= d < D two candidate leaders of neighbouring d-dimensional hypercubes should compete to become the single candidate leader of the (d+1)-dimensional hypercube that is the union of their respective hypercubes.

    Read the article

  • Algorithm to calculate the number of divisors of a given number

    - by sker
    What would be the most optimal algorithm (performance-wise) to calculate the number of divisors of a given number? It'll be great if you could provide pseudocode or a link to some example. EDIT: All the answers have been very helpful, thank you. I'm implementing the Sieve of Atkin and then I'm going to use something similar to what Jonathan Leffler indicated. The link posted by Justin Bozonier has further information on what I wanted.

    Read the article

  • Dijkstra shortest path algorithm with edge cost.

    - by Svisstack
    Hello, I have a directed, positive weighted graph. Each edge have a cost of use. I have only A money, i want to calculate shortest paths with dijkstra algorithm, but sum of edges costs on route must be less or equal to A. I want to do this with most smallest Dijstra modification (if I can do it with small modification of Dijkstra). Anyone can help me with this?

    Read the article

  • Sort algorithm with fewest number of operations

    - by luvieere
    What is the sort algorithm with fewest number of operations? I need to implement it in HLSL as part of a pixel shader effect v2.0 for WPF, so it needs to have a really small number of operations, considering Pixel Shader's limitations. I need to sort 9 values, specifically the current pixel and its neighbors.

    Read the article

  • efficient algorithm for drawing circle arcs?

    - by banister
    I am using the mid-point circle algorithm (bresenham circle) to efficiently draw whole circles. Is there something similar to draw circle arcs? I would like to specify a start angle and end angle and have only that portion of the circle drawn. Thanks in advance! EDIT: I would like to draw filled circle arcs too, i.e pie-slices. :)

    Read the article

  • Fastest sorting algorithm for a specific situation

    - by luvieere
    What is the fastest sorting algorithm for a large number (tens of thousands) of groups of 9 positive double precision values, where each group must be sorted individually? So it's got to sort fast a small number of possibly repeated double precision values, many times in a row. The values are in the [0..1] interval. I don't care about space complexity or stability, just about speed.

    Read the article

  • finding shortest valid path in a colored-edge graphs

    - by user1067083
    Given a directed graph G, with edges colored either green or purple, and a vertex S in G, I must find an algorithm that finds the shortest path from s to each vertex in G so the path includes at most two purple edges (and green as much as needed). I thought of BFS on G after removing all the purple edges, and for every vertex that the shortest path is still infinity, do something to try to find it, but I'm kinda stuck, and it takes alot of the running time as well... Any other suggestions? Thanks in advance

    Read the article

  • Good Java graph algorithm library?

    - by Nick Fortescue
    Has anyone had good experiences with any Java libraries for Graph algorithms. I've tried JGraph and found it ok, and there are a lot of different ones in google. Are there any that people are actually using successfully in production code or would recommend? To clarify, I'm not looking for a library that produces graphs/charts, I'm looking for one that helps with Graph algorithms, eg minimum spanning tree, Kruskal's algorithm Nodes, Edges, etc. Ideally one with some good algorithms/data structures in a nice Java OO API.

    Read the article

  • Parallel curve like algorithm for graphs

    - by skrat
    Is there a well know algorithm for calculating "parallel graph"? where by parallel graph I mean the same as parallel curve, vaguely called "offset curve", but with a graph instead of a curve. Given this picture how can I calculate points of black outlined polygons?

    Read the article

  • Algorithm for best positioning objects on a Visio model

    - by leandrosa81
    Hello, I am trying to map all network devices and create a visio file with the resulting network topology. I was wondering if there are any algorithm for best positioning the nodes on the graph, considering its connections. Connections are bidirectional, like this (may have many connections between the same nodes): --------- --------- | | | | | A |----------| B | |_______| |_______|

    Read the article

  • Algorithm for a dice problem

    - by vivekeviv
    I was thinking what should be the best algorithm for finding all the solutions of this puzzle. http://1cup1coffee.com/puzzle/endice/ Could backtracking be the an approach for solving this or can you suggest any other approach? Thanks

    Read the article

  • An algorithm for pavement usage calculation

    - by student
    Given an area of specific size I need to find out how many pavement stones to use to completely pave the area. Suppose that I have an empty floor of 100 metre squares and stones with 20x10 cm and 30x10 cm sizes. I must pave the area with minimum usage of stones of both sizes. Anyone knows of an algorithm that calculates this? (Sorry if my English is bad) C# is preferred.

    Read the article

  • What is the best algorithm for this problem?

    - by mark
    What is the most efficient algorithm to solve the following problem? Given 6 arrays, D1,D2,D3,D4,D5 and D6 each containing 6 numbers like: D1[0] = number D2[0] = number ...... D6[0] = number D1[1] = another number D2[1] = another number .... ..... .... ...... .... D1[5] = yet another number .... ...... .... Given a second array ST1, containing 1 number: ST1[0] = 6 Given a third array ans, containing 6 numbers: ans[0] = 3, ans[1] = 4, ans[2] = 5, ......ans[5] = 8 Using as index for the arrays D1,D2,D3,D4,D5 and D6, the number that goes from 0, to the number stored in ST1[0] minus one, in this example 6, so from 0 to 6-1, compare each res array against each D array My algorithm so far is: I tried to keep everything unlooped as much as possible. EML := ST1[0] //number contained in ST1[0] EML1 := 0 //start index for the arrays D While EML1 < EML if D1[ELM1] = ans[0] goto two if D2[ELM1] = ans[0] goto two if D3[ELM1] = ans[0] goto two if D4[ELM1] = ans[0] goto two if D5[ELM1] = ans[0] goto two if D6[ELM1] = ans[0] goto two ELM1 = ELM1 + 1 return 0 //bad row of numbers, if while ends two: EML1 := 0 start index for arrays Ds While EML1 < EML if D1[ELM1] = ans[1] goto two if D2[ELM1] = ans[1] goto two if D3[ELM1] = ans[1] goto two if D4[ELM1] = ans[1] goto two if D5[ELM1] = ans[1] goto two if D6[ELM1] = ans[1] goto two ELM1 = ELM1 + 1 return 0 three: EML1 := 0 start index for arrays Ds While EML1 < EML if D1[ELM1] = ans[2] goto two if D2[ELM1] = ans[2] goto two if D3[ELM1] = ans[2] goto two if D4[ELM1] = ans[2] goto two if D5[ELM1] = ans[2] goto two if D6[ELM1] = ans[2] goto two ELM1 = ELM1 + 1 return 0 four: EML1 := 0 start index for arrays Ds While EML1 < EML if D1[ELM1] = ans[3] goto two if D2[ELM1] = ans[3] goto two if D3[ELM1] = ans[3] goto two if D4[ELM1] = ans[3] goto two if D5[ELM1] = ans[3] goto two if D6[ELM1] = ans[3] goto two ELM1 = ELM1 + 1 return 0 five: EML1 := 0 start index for arrays Ds While EML1 < EML if D1[ELM1] = ans[4] goto two if D2[ELM1] = ans[4] goto two if D3[ELM1] = ans[4] goto two if D4[ELM1] = ans[4] goto two if D5[ELM1] = ans[4] goto two if D6[ELM1] = ans[4] goto two ELM1 = ELM1 + 1 return 0 six: EML1 := 0 start index for arrays Ds While EML1 < EML if D1[ELM1] = ans[0] return 1 //good row of numbers if D2[ELM1] = ans[0] return 1 if D3[ELM1] = ans[0] return 1 if D4[ELM1] = ans[0] return 1 if D5[ELM1] = ans[0] return 1 if D6[ELM1] = ans[0] return 1 ELM1 = ELM1 + 1 return 0 As language of choice, it would be pure c

    Read the article

  • Algorithm for deciding price ranges.

    - by Paul Knopf
    I am looking for code that will take a huge list of numbers, and calculate price ranges correctly. There must be some algorithm that will choose the proper ranges, no? I am looking for this code in c#, but any language will do (I can convert). Thanks in advance!

    Read the article

  • Reducing Integer Fractions Algorithm - Solution Explanation?

    - by Andrew Tomazos - Fathomling
    This is a followup to this problem: Reducing Integer Fractions Algorithm Following is a solution to the problem from a grandmaster: #include <cstdio> #include <algorithm> #include <functional> using namespace std; const int MAXN = 100100; const int MAXP = 10001000; int p[MAXP]; void init() { for (int i = 2; i < MAXP; ++i) { if (p[i] == 0) { for (int j = i; j < MAXP; j += i) { p[j] = i; } } } } void f(int n, vector<int>& a, vector<int>& x) { a.resize(n); vector<int>(MAXP, 0).swap(x); for (int i = 0; i < n; ++i) { scanf("%d", &a[i]); for (int j = a[i]; j > 1; j /= p[j]) { ++x[p[j]]; } } } void g(const vector<int>& v, vector<int> w) { for (int i: v) { for (int j = i; j > 1; j /= p[j]) { if (w[p[j]] > 0) { --w[p[j]]; i /= p[j]; } } printf("%d ", i); } puts(""); } int main() { int n, m; vector<int> a, b, x, y, z; init(); scanf("%d%d", &n, &m); f(n, a, x); f(m, b, y); printf("%d %d\n", n, m); transform(x.begin(), x.end(), y.begin(), insert_iterator<vector<int> >(z, z.end()), [](int a, int b) { return min(a, b); }); g(a, z); g(b, z); return 0; } It isn't clear to me how it works. Can anyone explain it? The equivilance is as follows: a is the numerator vector of length n b is the denominator vector of length m

    Read the article

  • random, Graphics point ,searching- algorithm, via dual for loop set

    - by LoneXcoder
    hello and thanks for joining me in my journey to the custom made algorithm for "guess where the pixel is" this for Loop set (over Point.X, Point.Y), is formed in consecutive/linear form: //Original\initial Location Point initPoint = new Point(150, 100); // No' of pixels to search left off X , and above Y int preXsrchDepth, preYsrchDepth; // No' of pixels to search to the right of X, And Above Y int postXsrchDepth, postYsrchDepth; preXsrchDepth = 10; // will start search at 10 pixels to the left from original X preYsrchDepth = 10; // will start search at 10 pixels above the original Y postXsrchDepth = 10; // will stop search at 10 pixels to the right from X postYsrchDepth = 10; // will stop search at 10 pixels below Y int StopXsearch = initPoint.X + postXsrchDepth; //stops X Loop itarations at initial pointX + depth requested to serch right of it int StopYsearch = initPoint.Y + postYsrchDepth; //stops Y Loop itarations at initial pointY + depth requested below original location int CountDownX, CountDownY; // Optional not requierd for loop but will reports the count down how many iterations left (unless break; triggerd ..uppon success) Point SearchFromPoint = Point.Empty; //the point will be used for (int StartX = initPoint.X - preXsrchDepth; StartX < StopXsearch; StartX++) { SearchFromPoint.X = StartX; for (int StartY = initPoint.Y - preYsrchDepth; StartY < StpY; StartY++) { CountDownX = (initPoint.X - StartX); CountDownY=(initPoint.Y - StartY); SearchFromPoint.Y = StartY; if (SearchSuccess) { same = true; AAdToAppLog("Search Report For: " + imgName + "Search Completed Successfully On Try " + CountDownX + ":" + CountDownY); break; } } } <-10 ---- -5--- -1 X +1--- +5---- +10 what i would like to do is try a way of instead is have a little more clever approach <+8---+5-- -8 -5 -- +2 +10 X -2 - -10 -8-- -6 ---1- -3 | +8 | -10 Y +1 -6 | | +9 .... I do know there's a wheel already invented in this field (even a full-trailer truck amount of wheels (: ) but as a new programmer, I really wanted to start of with a simple way and also related to my field of interest in my project. can anybody show an idea of his, he learnt along the way to Professionalism in algorithm /programming having tests to do on few approaches (kind'a random cleverness...) will absolutely make the day and perhaps help some others viewing this page in the future to come it will be much easier for me to understand if you could use as much as possible similar naming to variables i used or implenet your code example ...it will be Greatly appreciated if used with my code sample, unless my metod is a realy flavorless. p.s i think that(atleast as human being) the tricky part is when throwing inconsecutive numbers you loose track of what you didn't yet use, how do u take care of this too . thanks allot in advance looking forward to your participation !

    Read the article

  • Latex: Listing all figures (tables, algorithm) once again at the end of the document

    - by Zlatko
    Hi all, I have been writhing a rather large document with latex. Now I would like to list all the figures / tables / algortihms once again at the end of the file so that I can check if they all look the same. For example, if every algorithm has the same notation. How can I do this? I know about \listofalgorithms and \listoffigures but they only list the names of the algorithms or figures and the pages where they are. Thanks.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >