fuck off boomie i'm going to use the algorithims in the standard libarary. no i'm not going to write my own and no i'm not going to feel inferior for that. nobody cares about you CS prof larp, the std lib algos are faster than the textbook theory shit you vomit
Too slow, sorry. Imagine a string of million characters, do you unironically go through every single character just to see whether you need to change it to an a?
I'm guessing there's more to it than just stopping once you found 10% the string-length of non-a's, but just that should be faster most of times, right?
If you know nothing about the distribution it really doesn’t help. I guess you could do something like after finding a non-a you skip the next 5% of the string, but you’ll likely miss one and have to repeat the process anyways.
Hint 2: work with the assumption that there's only one a in a gigantic string that you need to reverse. Now extrapolate it to 2 A's, 10 A's, 1% A's and so on...
8 months ago
Anonymous
does it matter? you can put the length of several strings together and calculate 10% of that as well, or just make it a loop. But why would you look at the A's rather than the rest? length-check is included in reversed() so there's no reason to not use it rather than counting A's, or is that part of what is poorly optimized about it?
If you know nothing about the distribution it really doesn’t help. I guess you could do something like after finding a non-a you skip the next 5% of the string, but you’ll likely miss one and have to repeat the process anyways.
Hint: use statistics. You literally know that 9/10 times the character will be an "a", and you do nothing with this information.
[...]
Hint 2: work with the assumption that there's only one a in a gigantic string that you need to reverse. Now extrapolate it to 2 A's, 10 A's, 1% A's and so on...
Nice troll. The output complexity is linear. You will have a hard time going faster.
>Are YOU better
I don't think so, because what I'd do is load, vpshufb, store. Assuming non-Unicode, anyway. I don't see how you could be faster than that regardless of what the string contains. What did you have in mind?
And the people bowed and prayed
To the neon god they made
And the sign flashed out its warning
In the words that it was forming
And the sign said, "The words of the prophets are written on the subway walls and tenement halls
And whispered in the sound of silence"
>He will not shout or cry out, or raise his voice in the streets. A bruised reed he will not break, and a smoldering wick he will not snuff out. In faithfulness he will bring forth justice;
>>> 'reggin'[::-1]
fuck off boomie i'm going to use the algorithims in the standard libarary. no i'm not going to write my own and no i'm not going to feel inferior for that. nobody cares about you CS prof larp, the std lib algos are faster than the textbook theory shit you vomit
>CS
It's over before it even began for you kek
if 'a', push back 'a'
else, push back ch[no]
?
Too slow, sorry. Imagine a string of million characters, do you unironically go through every single character just to see whether you need to change it to an a?
Default to 'a'
if a do nothing
else insert ch[no]
?
Hint: use statistics. You literally know that 9/10 times the character will be an "a", and you do nothing with this information.
I'm guessing there's more to it than just stopping once you found 10% the string-length of non-a's, but just that should be faster most of times, right?
Hint 2: work with the assumption that there's only one a in a gigantic string that you need to reverse. Now extrapolate it to 2 A's, 10 A's, 1% A's and so on...
does it matter? you can put the length of several strings together and calculate 10% of that as well, or just make it a loop. But why would you look at the A's rather than the rest? length-check is included in reversed() so there's no reason to not use it rather than counting A's, or is that part of what is poorly optimized about it?
If you know nothing about the distribution it really doesn’t help. I guess you could do something like after finding a non-a you skip the next 5% of the string, but you’ll likely miss one and have to repeat the process anyways.
Nice troll. The output complexity is linear. You will have a hard time going faster.
>Are YOU better
I don't think so, because what I'd do is load, vpshufb, store. Assuming non-Unicode, anyway. I don't see how you could be faster than that regardless of what the string contains. What did you have in mind?
>561 KB
WTF is wrong with you? KYS.
All you need is a mirror.
?t=175
And the people bowed and prayed
To the neon god they made
And the sign flashed out its warning
In the words that it was forming
And the sign said, "The words of the prophets are written on the subway walls and tenement halls
And whispered in the sound of silence"
The word of the prophets are the schizos
the sign = the profile pic
>He will not shout or cry out, or raise his voice in the streets. A bruised reed he will not break, and a smoldering wick he will not snuff out. In faithfulness he will bring forth justice;