Sujet : Re: realloc() - frequency, conditions, or experiences about relocation?
De : anton.txt (at) *nospam* g{oogle}mail.com (Anton Shepelev)
Groupes : comp.lang.c sci.stat.mathDate : 08. Jul 2024, 17:34:56
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240708193456.a1ebe2d0872239c525120d84@g{oogle}mail.com>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
I had plumb forgot about this solution of mine:
p0 = 1-e^(L*x0) ,
p1 = 1-e^(L*x1) ,
x1 = k*x0 (by our strategy), =>
p1 = 1-(1-p0)^k .
>
which does not depend on the distribution and lets us
generalise this approach for any distribution:
>
x1 = Q( 1 - ( 1 - CDF(x0) )^k )
where:
>
x0 : the required size
x1 : the new recommended capacity
Q(p) : the p-Quantile of the given distribution
CDF(x): the CDF of the given distribution
k>1 : balance between speed and space efficiency
Let us test it with the exponential distribution, for which:
Q (p) = -Ln( 1 - p )/L
CDF(x) = 1 - e^(-Lx)
Substituting these into the equation for x1:
x1 = Q ( 1 - ( 1 - ( 1 - e^(-Lx0) ) )^k ) =
Q ( 1 - ( e^(-Lx0) )^k ) =
Q ( 1 - e^(-kLx0) ) =
-Ln( e^(-kLx0) )/L = k*x0 (QED)
That is, my solution is a/the generalisation of the
exponential growth strategy.
-- () ascii ribbon campaign -- against html e-mail/\ www.asciiribbon.org -- against proprietary attachments
Date | Sujet | # | | Auteur |
17 Jun 24 | Re: realloc() - frequency, conditions, or experiences about relocation? | 22 | | Anton Shepelev |
18 Jun 24 |  Re: realloc() - frequency, conditions, or experiences about relocation? | 1 | | David Jones |
19 Jun 24 |  Re: realloc() - frequency, conditions, or experiences about relocation? | 8 | | David Duffy |
19 Jun 24 |   Re: realloc() - frequency, conditions, or experiences about relocation? | 6 | | Malcolm McLean |
19 Jun 24 |    Re: realloc() - frequency, conditions, or experiences about relocation? | 3 | | Ben Bacarisse |
19 Jun 24 |     Re: realloc() - frequency, conditions, or experiences about relocation? | 2 | | David Brown |
19 Jun 24 |      Re: realloc() - frequency, conditions, or experiences about relocation? | 1 | | Ben Bacarisse |
19 Jun 24 |    Re: realloc() - frequency, conditions, or experiences about relocation? | 2 | | Anton Shepelev |
8 Jul 24 |     Re: realloc() - frequency, conditions, or experiences about relocation? | 1 | | Anton Shepelev |
19 Jun 24 |   Re: realloc() - frequency, conditions, or experiences about relocation? | 1 | | Anton Shepelev |
2 Jul 24 |  Re: realloc() - frequency, conditions, or experiences about relocation? | 12 | | Rich Ulrich |
2 Jul 24 |   Re: realloc() - frequency, conditions, or experiences about relocation? | 5 | | Keith Thompson |
2 Jul 24 |    Re: realloc() - frequency, conditions, or experiences about relocation? | 4 | | Rich Ulrich |
8 Jul 24 |     Re: realloc() - frequency, conditions, or experiences about relocation? | 3 | | Anton Shepelev |
22 Jul 24 |      Re: realloc() - frequency, conditions, or experiences about relocation? | 2 | | Rich Ulrich |
23 Jul 24 |       Re: realloc() - frequency, conditions, or experiences about relocation? | 1 | | Anton Shepelev |
2 Jul 24 |   Re: realloc() - frequency, conditions, or experiences about relocation? | 6 | | Paul |
2 Jul 24 |    Re: realloc() - frequency, conditions, or experiences about relocation? | 5 | | Rich Ulrich |
2 Jul 24 |     Re: realloc() - frequency, conditions, or experiences about relocation? | 4 | | Rich Ulrich |
2 Jul 24 |      Re: realloc() - frequency, conditions, or experiences about relocation? | 3 | | Paul |
2 Jul 24 |       Re: realloc() - frequency, conditions, or experiences about relocation? | 1 | | James Kuyper |
2 Jul 24 |       Re: realloc() - frequency, conditions, or experiences about relocation? | 1 | | James Kuyper |