<![CDATA[Programmer's Town - Algorithms]]>
http://www.progtown.com/
Thu, 12 Jan 2017 13:21:00 +0000PunBB<![CDATA[From a multidimentional array to receive a tree.]]>
http://www.progtown.com/topic2049867-from-a-multidimentional-array-to-receive-a-tree.html
Good afternoon, there is a data structure received by sampling of a DB of hierarchical structure, let there will be a City-region-device, designate them for simplicity numerical values. We receive a dial-up of tuples, I so understand they should be is not mandatory arranged 1 1 1 1 1 2 1 2 3 1 3 3 2 4 6 2 4 7 2 4 8 3 5 9 1 5 6 It should turn out 1 | 1 | 1 2 5 | 6 2 | 3 2 4 | 6 7 3 5 | 9 Question consists here in what, in my opinion the task is similar on standard and the title seems to me to it already invented or it is necessary to solve independently? I am interested in respect of high-speed performance since the tree turns out the order of several thousand nodes.]]>Thu, 12 Jan 2017 13:21:00 +0000http://www.progtown.com/topic2049867-from-a-multidimentional-array-to-receive-a-tree.html<![CDATA[How to search for algorithms on columns?]]>
http://www.progtown.com/topic2049868-how-to-search-for-algorithms-on-columns.html
Normally the graph is defined as ordered pair from two sets - sets of peaks of this graph (they nodes) and sets of communications of this graph (they edges, arcs = directed edges). : = <in, the simple graph, and the graph with peaks of different types (probably it is called "the colored peaks") is necessary To me not. And not only the graph, but also the search algorithm in the directional graph of a subgraph with the given coloring (in that specific case not a subgraph, and a chain). Chain search in the colored directional acyclic graph you tell - sit down and think. Searches, searches. We sort out all peaks of the graph, for everyone we look - whether there is the way starting with to this peak completely coinciding with a chain. I in such decision do not like two moments: 1) at adding of new peak (with communications) in the graph it will be necessary to reconsider all, and it is unduly labor-consuming. 2) generally the full search looks unduly labor-consuming. There is an inspiring algorithm of the Whip-morrisa-pratta in which the amount of actions decreases (at them there, truth, not the graph and a chain, and is simple two chains). You tell - it is necessary to you , put a chain different nodes to the peak new interposed into the graph and check presence of both tails of a chain in the column. But also here, me it seems, it is possible to spare, if the graph beforehand in addition to label. How the algorithm necessary to me is called and how for it to search?]]>Wed, 11 Jan 2017 10:11:00 +0000http://www.progtown.com/topic2049868-how-to-search-for-algorithms-on-columns.html<![CDATA[To calculate a logarithmic scale]]>
http://www.progtown.com/topic2049869-to-calculate-a-logarithmic-scale.html
It is given - a certain dial-up of values with the allocation similar on logarithmic. A question - how approximately to count the logarithm base at which the logarithmic schedule will be as much as possible close to the linear?... <<RSDN@Home 1.0.0 alpha 5 rev. 0 on Windows 8 6.2.9200.0>>]]>Thu, 05 Jan 2017 11:28:00 +0000http://www.progtown.com/topic2049869-to-calculate-a-logarithmic-scale.html<![CDATA[Cogwheels, evolvents and everything, all, all]]>
http://www.progtown.com/topic2049870-cogwheels-evolvents-and-everything-all-all.html
Hello! There was here a task to think a gear program. Esteemed about them, understood nothing, understood only what not all so is simple. Moreover in different docks so walking around terminology are transited that line not clearly. And the most part of materials is devoted calculations for choice a material for for the given loading, and other to subtleties. And how to calculate geometry - normally hold back. Remembered only that a cogwheel of smaller diameter name a gear, and - by a wheel the algorithm Is interesting to set a pack of parameters, and on an output - an array from arcs and segments, or somehow so. Still separately became interested - and there is something by calculation of cogwheels of the arbitrary form? For any different variants of non-uniform transmission of driving? There, for example, for conjugation of pair toothed "squares" and ? In the same place all will be not how for a round wheel? Found any plug-in to on a python - I try to understand. There with the theory rather badly, one calculations. While line not clearly, as what for there becomes]]>Tue, 27 Dec 2016 17:04:00 +0000http://www.progtown.com/topic2049870-cogwheels-evolvents-and-everything-all-all.html<![CDATA[Classification and probability theory]]>
http://www.progtown.com/topic2047003-classification-and-probability-theory.html
Long not to tell I will try to invent the task and to adapt for it. Assume I predict the list from 5 books which will be bought by the user with the greatest probability. In total books of 24 possible. I have a model which on features of the user gives the forecast, it not bad works, but does not consider change of popularity of books in due course. And it is considerable. Assume I was trained on 06 month 2015 and I should make the forecast for 06 months 2016. For some user the forecast is received: [0.00273501 0.00273501 0.21609817 0.00411186 0.00925567 0.1917159 0.04742743 0.00293886 0.00331788 0.01592568 0.00443959 0.00344877 0.04274225 0.01281825 0.00274041 0.01408142 0.00274985 0.12125014 0.01134686 0.00730866 0.00296034 0.10991038 0.04232292 0.12561873] Number of a position in an array it also is the book. Further it is sorted and undertakes 5 with the greatest probabilities. But not an essence. In 15 year there was a following amount of books [1 0 3878 5 2347 40 531 226 131 0 0 46 2709 61 3 22 7 279 4248 183 7 5488 5513 10163] In 16 year this amount changed [0 0 6731 9 1872 8 211 216 152 290 33 956 1205 245 4 19 8 2933 4684 152 3 5082 8147 9031] And I would like to make correction of the forecast for value of change of popularity. For example, the third book almost twice grew on popularity. It would Seem it is necessary to divide an amount in 16 year for 15 year and to increase by probabilities of the forecast. But it is impossible so to do. Since for 6th book coefficient turns out unfairly big (40/8). I.e. it is necessary also total number somehow to consider. A question as it do?]]>Mon, 19 Dec 2016 08:28:00 +0000http://www.progtown.com/topic2047003-classification-and-probability-theory.html<![CDATA[Algorithm of sifting of the wrong data]]>
http://www.progtown.com/topic2047004-algorithm-of-sifting-of-the-wrong-data.html
There are certain sensors transferring measurements through a certain interval of time t +-x seconds. Results of measurement well enough can be described by curves. Though sensor transfer from place to place or generally its switch-off for some time is possible. In the course of the analysis of results it was clarified that sensors sometimes "say lies" thus the data much more often or less often. It would be desirable to eliminate the wrong data. But that that too difficult turns out. Thought the data, and after to discard that quit on value and an interval. But thus the saltus of the data "disappears" at sensor control/switching-off transfer. That is again it is necessary on this variant that that to mold. Or nevertheless it does not turn out easier?]]>Sat, 17 Dec 2016 13:06:00 +0000http://www.progtown.com/topic2047004-algorithm-of-sifting-of-the-wrong-data.html<![CDATA[2]]>
http://www.progtown.com/topic2047005-2.html
Greetings if it is still interesting to you max (x, y) = 0.5 (x + y + abs (x - y)) min (x, y) = 0.5 (x + y - abs (x - y))]]>Fri, 16 Dec 2016 04:13:00 +0000http://www.progtown.com/topic2047005-2.html<![CDATA[How apply ?]]>
http://www.progtown.com/topic2047006-how-apply.html
I basically well understand, how works Bitcoin. In last year/months it is a lot of news how the technology is applied by the different organizations, like banking join. And here here I at all do not understand it. What for it how they apply it and than it is better than the normal central server? There after all it is explicit not . Interests from the algorithmic point of view and to understand, how this can be applied in projects.]]>Wed, 14 Dec 2016 07:47:00 +0000http://www.progtown.com/topic2047006-how-apply.html<![CDATA[The search algorithm of all cycles in the column]]>
http://www.progtown.com/topic2047007-the-search-algorithm-of-all-cycles-in-the-column.html
The directional graph is given, set structurally i.e. the peak can contain references to other peaks. It is necessary to find all cycles in the column. What it is possible to look at this subject?]]>Thu, 08 Dec 2016 07:26:00 +0000http://www.progtown.com/topic2047007-the-search-algorithm-of-all-cycles-in-the-column.html<![CDATA[Algorithm of Flojda for search]]>
http://www.progtown.com/topic2043848-algorithm-of-flojda-for-search.html
Esteemed in , in an Internet here but I do not catch up as it works. An example here from the link 60> 50> 40> 30> 20> 10> 40 why such phrase For example here is written: when tortoise comes to 40 hare is at 20 inside the loop.then they both meet at 20. When a turtle on 40, a hare after all on 20 why it is written then they both meet at 20 and Now send tortoise back to first node in the list. Let them both iterate at same speed (one node per step) then I how much understood we should send a turtle on start, when identical values. That is if both the turtle and a hare were on 20 yes, we send a turtle on start. It would be healthy, if someone the code on or]]>Sat, 26 Nov 2016 13:46:00 +0000http://www.progtown.com/topic2043848-algorithm-of-flojda-for-search.html<![CDATA[Point hit in a circuit]]>
http://www.progtown.com/topic2043849-point-hit-in-a-circuit.html
Is available N points at which bypass the closed circuit is formed. It is necessary to learn, whether the given point in this circuit gets or remains outside. It is desirable without trigonometry, and other long calculations since it will be fulfilled on the microcontroller.]]>Mon, 21 Nov 2016 04:14:00 +0000http://www.progtown.com/topic2043849-point-hit-in-a-circuit.html<![CDATA[Recommendatory systems]]>
http://www.progtown.com/topic2043850-recommendatory-systems.html
Colleagues, can advise the book on collaborative filtering. It is desirable with examples and the code on Python or R. Also it is desirable more less deep immersing in a subject, SVD ++, RBM, etc.]]>Thu, 10 Nov 2016 03:11:00 +0000http://www.progtown.com/topic2043850-recommendatory-systems.html<![CDATA[Modeling of mechanical systems]]>
http://www.progtown.com/topic2043851-modeling-of-mechanical-systems.html
All greetings! Prompt where it is possible to esteem about programming of mechanical systems (it is desirable With ++). In my case is 2D, specific mechanisms with a heap of parameters, nodes, communications and /. On the one hand - it would not be desirable to invent a bicycle, but usage of special packets or indirect libraries too does not approach. Thanks]]>Tue, 08 Nov 2016 15:05:00 +0000http://www.progtown.com/topic2043851-modeling-of-mechanical-systems.html<![CDATA[Problem of the adjacent coins (The Adjacent Coins Problem)]]>
http://www.progtown.com/topic2043852-problem-of-the-adjacent-coins-the-adjacent-coins-problem.html
The description and the correct implementation here. There is a task, to correct the variant offered more low changing no more than three lines. On a test dial-up where for example A [] = {0, 0}, the correct implementation produces 0, that that more low - 1. Help to rectify an error. public int solution (int [] A) {//n length of the array int n = A.Length; int result = 0;//Calculate the number of consecutive identical ones, for both sides for (int i = 0; i <n - 1; i ++)//why n - 1 {if (A [i] == A [i + 1]) result = result + 1;}//Calculate max delta int r = 0; for (int i = 0; i <n; i ++) {//count: current delta int count = 0; if (i> 0) {if (A [i - 1]! = A [i]) count = count + 1; else count = count - 1;} if (i <n - 1) {if (A [i + 1]! = A [i]) count = count + 1; else count = count - 1;} r = Math. Max (r, count);}//max]]>Mon, 07 Nov 2016 19:26:00 +0000http://www.progtown.com/topic2043852-problem-of-the-adjacent-coins-the-adjacent-coins-problem.html<![CDATA[Prediction of allocation of players in places]]>
http://www.progtown.com/topic2043853-prediction-of-allocation-of-players-in-places.html
Hello. We present that at us is N players with certain indexes of skill P 1... N. We admit that probability to win first place in tournament at the player n = P n / SUMM (P 1... N). Well, that is the probability of a victory is equal to specific skill of the player concerning all group. We admit that in case of a victory (1st place) there is nobody the player n, the probability to take the second place is arranged similarly (only now from an estimation n th player is thrown out). That is remained N - 1 players divide 2nd place the same as all group divided the first. And so to the end, to the last place. It is necessary to receive the table where in each cell there will be a probability of a place for this or that player. Here calculation for three players with ability 50, 30 and 20 accordingly. It is possible to note that the total on each line and a column is equal to unit (that logically and is necessary). Players 1 2 3 Skill 50 30 20 1 place 0,5 0,3 0,2 2 place 0,339285714 0,375 0,285714286 3 place 0,160714286 0,325 0,514285714 Algorithm which I calculated these values, in the front sorts out all variants and considers total probabilities. For 3 players it still where did not go, but for tens we receive very not sickly rows and swaps. It seems to me, in the games theory should be either ready, or the similar decision of the given problem.]]>Sun, 06 Nov 2016 10:28:00 +0000http://www.progtown.com/topic2043853-prediction-of-allocation-of-players-in-places.html