Afişează mesaje
|
Pagini: [1]
|
6
|
infoarena - concursuri, probleme, evaluator, articole / Informatica / Răspuns: Shell Sort
|
: Aprilie 20, 2009, 10:04:59
|
http://en.wikipedia.org/wiki/Shell_sort#Gap_sequenceThe best known sequence according to research by Marcin Ciura is 1, 4, 10, 23, 57, 132, 301, 701, 1750. This study also concluded that "comparisons rather than moves should be considered the dominant operation in Shellsort." A Shell sort using this sequence runs faster than an insertion sort or a heap sort, but even if it is faster than a quicksort for small arrays, it is slower for sufficiently big arrays. After 1750, gaps in geometric progression can be used, such as: nextgap = round(gap * 2.3) Another sequence which performs empirically well is the Fibonacci numbers (leaving out one of the starting 1's) to the power of two times the golden ratio, which gives the following sequence: 1, 9, 34, 182, 836, 4025, 19001, 90358, 428481, 2034035, 9651787, 45806244, 217378076, 1031612713.
|
|
|
7
|
infoarena - concursuri, probleme, evaluator, articole / Arhiva de probleme / Răspuns: 187 Ecuatii
|
: Aprilie 07, 2009, 07:57:04
|
Spuneti-mi va rog ce imi scapa la algoritmul urmator  for (i=-50; i<=50; ++i) for (j=-50; j<=50; ++j) if (i*j) aduga -a1*i*i*i-a2*j*j*j in lista valorilor; for (i=-50; i<=50; ++i) for (j=-50; j<=50; ++j) for (k=-50; k<=50; ++k) if (i*j*k) daca a3*i*i*i+a4*j*j*j+a5*k*k*k se afla in lista valorilor nrsol=nrsol+1;
Multumesc! In cazul in care -a1*i*i*i-a2*j*j*j a mai fost deja calculat ce faci? Incearca sa analizezi cazul asta. Si eu ma blocasem la 20, dar cu o mica modificare ajunsai la 100.
|
|
|
|