Afişează mesaje
Pagini: [1]
1  Comunitate - feedback, proiecte si distractie / Blog / Răspuns: Interactive problems shortlist : Martie 16, 2013, 20:59:51
3) Let us define a function f(S) that returns the smallest 2 numbers of a set S and let N be the size of S

We form pairs of neighbouring positions in S ex. (1, 2); (3, 4); ... . If N is odd we keep position N by itself.
We proceed in doing [ N / 2 ] comparisons and finding the minimum of each pair. With this minimums we forms a second set S2. We call f(S2). The minimum in S is the minimum in S2 and the second minimum in S is the minimum between f(S2).second and pair( f(S2).first ). By pair(x) we denote the other element in the pair where we find x. For the example pair(2) = 1 and pair(3) = 4.

Let T(N) the number of comparisons for a set of N elements. It can be obtained by the reccurence T(N) = floor(N / 2) + T( floor((N+1) / 2) ) + 1. T(2) = 1; Solving the reccurence  Read This! gives us T(N) = N + ceil(log2(N)) - 2 for any N >= 2.
2  infoarena - concursuri, probleme, evaluator, articole / Concursuri / Răspuns: Yakutia : Iulie 15, 2012, 16:15:37
Felicitari! Tot asa !  Applause
3  infoarena - concursuri, probleme, evaluator, articole / FMI No Stress 2012 / Răspuns: Vmin : Mai 11, 2012, 16:54:49
Daca sunt doua functii care au valoarea minima intr-un moment cerut care din ele le afisam ?
4  infoarena - concursuri, probleme, evaluator, articole / FMI No Stress 2012 / Răspuns: Vmin : Mai 11, 2012, 14:24:53
Care sunt limitele T-ului?
5  infoarena - concursuri, probleme, evaluator, articole / Arhiva de probleme / Răspuns: 624 Tije : Decembrie 21, 2007, 14:07:53
eu fac chestia cu mutarile la dreapta...ca in concurs....am sa incerc sa o optimizez... Smile
6  infoarena - concursuri, probleme, evaluator, articole / Arhiva de probleme / tije : Decembrie 21, 2007, 13:19:08
care e faza la problema asta...in timp de concurs am luat 100 iar acu iau doar 80 Think ...trebuie optimizata ?
Pagini: [1]
Powered by SMF 1.1.19 | SMF © 2006-2013, Simple Machines