- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
which one is faster, Bogosort or Fristsort?
Admin
WOW!
I would never have thought that I would see a bogosort in the wild
Well played sir!
Yazeran.
Plan: To go to Mars one day with a hammer.
Admin
Bogosort this, motherf****r
Admin
I particularly like the link in the "documentation" that points to Stack Overflow ... specifically, a discussion on how to implement Fisher-Yates in Objective-C. This ain't no ordinary bogosort -- this is an argumentum ad auctaritatem bogosort!
Admin
Wow indeed!
So what's next, stack sort (https://gkoberger.github.io/stacksort/)?
Admin
To my mind, the true WTF is obj-C. Take C. Add all the features of C++ just renamed (null->nil, this->self, etc.). The one project I did with obj-C at least accommodated the previously written C++. It's ok, everyone. I've had extensive therapy since.
Admin
Apparently a "bogo" sort, is a "BOGus sOrt".
Admin
From what I can tell, Objective C was invented in 1984 and C++ in 1985. Also Objective C copied all that from Smalltalk (1972). (I am assuming that the syntaxes quoted above are unchanged from the beginning of the language's life, since they are so fundamental.)
Admin
Invented versus released into the wild are different, of course. But which was invented first seems to be a bit fuzzy. Stroustrup was fiddling with the precursor to C++ in 1979. Obj-C was "early 80's" according to what I read. I only did one project using obj-C and that project began in C++ for Windows, then ported to Mac. I found the languages enough alike and enough different that it simply drove me nuts. I'll have to get paid a whole lot better to try that stunt again.
Admin
My favorite is actually the if(YES).
Admin
Oh it's a while. Either way.
Admin
So what was the assumption stated in _reloadTableDataAnimatedAdvanced?
Admin
Looks like the "NeXTSTEP" would be to rewrite this function.
(I'll show myself out.)
Admin
I'm guessing the implementation of the plan involves hitting random objects with the hammer until one fonds one's self on Mars?
(Not a true random chance, as eventually someone will load you onto a hammer-resistant rocket bound for Mars, just to get rid of you.)
Admin
I am genuinely and sincerely baffled as to what derangement would cause someone to code such a thing in the first place. Were they trying to pad out their line count with something that looks like it does Important Stuff?
Admin
They work very differently under the covers. C++ is faster, Obj-C is much more flexible; this is because C++ tries to avoid even the simplest forms of dynamic dispatch (which is why we ended up with template specialization) whereas Obj-C is totally built around dynamic dispatch even if you don't normally see it.
Admin
Well it could be that, or just that I by education is a geologist (long time ago) and we tend to go and bang on rocks with hammers' ;-)
Admin
"Obj-C is a bit odd to read"
Especially so when I have to move the horizontal scroll bar back and forth to read each line.
It's 2019. My monitor is wider than 1024. Please stop pillarboxing these articles.
Admin
Of course, Apple realized that forcing people to use an esoteric language to program on their platform limited recruitment of talent, so they finally abandoned Objective C for Swift.
Admin
The main WTF hides a smaller one: using the diff algorithm for just checking equality. Why do something in O(n) time and O(1) space when you can go O(n^2) time and O(n) or O(n^2) space?
Too good (bad) to believe? An Intelligently Created WTF?
Admin
Even the suggested solution is overworked; surely one just needs to have the old and new lists sorted and do a merge, deleting and adding as you go?
Admin
I had to look up bogo sort. First thing I thought was WTF? Second thought: even evolution works faster using natural selection.
Admin
That complete derp who is responsible for the code used sets. Sets cannot contain duplicates. So if two of the old and new strings are the same, you lose one string and if that string wasn’t the first or last string of one of the arrays, you’d loop forever. (There was actually no reason at all to use NSSet).
Admin
Watson: No, the old and new list are not sorted. The result, if there are no duplicate strings, is an array either containing the original strings in their original order, followed by the new strings in their original order, or the new strings followed by the old strings, also both in original order.