[your code here]
SeeWebsiteForEmail at erdani.org
Sat Feb 4 20:53:14 PST 2012
On 2/4/12 10:05 PM, Manfred Nowak wrote:
> Jos van Uden wrote:
>> bool isPangram
> The presented code is not an acceptable example for the usage of the D
> programming language.
> `indexOf( s, c)' has a worst case running time of O( `s.length').
> `indexOf' is called once for each `c' in the used member `alpha' of
> Therefore the runtime of the presented code is
> O( `s.length' * `alpha.length')
> O( `s.length' + `alpha.length')
> is possible.
> The optional third parameter of `indexOf' can be called with
> `CaseSensitive.no'. But that parameter is left untouched. Instead a
> check with `toUpper( c)' is used, thereby risking a further visitation
> of the whole string .
> The use of the literal value `-1' stands out of the code and hints to a
> maldesign in phobos. This is because `-1' is not mnemonic.
Sensible arguments. Would you want to redo the example in better style?
More information about the Digitalmars-d