- 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
Not even that. If the shuffling is truly random, there's just no guarantee the code will ever terminate; no matter how many iterations you've gone through previously, at each step, you're no more likely to hit upon the correctly sorted order than you were before.
That, again, assumes the shuffling is truly random. If it is only pseudo-random, it gets more complicated than I want to think about at this late hour, but I'll lay down a pair of conjectures: for a given pseudo-random number generation and seed, there will exist inputs for which the algorithm is guaranteed to never terminate. (The obvious place to start digging: inputs whose lenght is longer than the cycle of the PRNG.)
Admin
Back in my day ...
That's nothing. Back in my day we had to punch machine code on paper tape using our teeth, and we were grateful!
Admin
You could always shell out to DOS and pipe it through the sort command, then read in the sorted results :)
Admin
This lack the brute force wrongness that the current WTF provide.
Its more like tossing 5 years old childrens to save the drowning one guy. If the 5yo drow too, drop more.
Admin
It just sort of sounds a little like a course I took a couple years back. It dealt with programming a real-time application, with semaphores and all. They had us program in Pascal under Windows NT's DOS emulation. For Pascal we installed RTKernel, I guess that made this not-so-real-time combination of a DOS-based programming language in a not-so-real-time operating system real-time but it seems.. I dunno.. sad, somehow.
I mean, if I'm asked if I have experience with programming real-time applications, dare I say "sure, I've experience with Pascal under NT to do my real-time programming! Bring it on!"?
I'm not sure...
Admin
Admin
However, if you use a quantum source of randomness to permute the elements and really believe in the many-worlds theory of quantum mechanics - that all things that could happen at a quantum level do and that branching universes are created for each possible outcome - then you can change the algorithm to simply permute the elements once and then check to see if it's ordered. If the list is not ordered, destroy the universe*. In the universe that's left, you've just created an O(n) sort. Tada!
*Destroying the universe is left as an exercise for the reader.
Admin
COBOL do have a soul. Old Cobol programs never died.
Admin
Oh yeah, right, sure they are!
Admin
You can learn C++ with Borland C++ 3.1 on ms-dos on Windows2000. Its just a convenient way to learn the basics. Then you can continue with "Borland Builder" or "Microsoft Visual C++" and make Windows apps.
Hell.. you will finish tryiing to use the Windows API, but is a poorly start for C++ start with the Windows API.
1) Lesson #1, "for", "while", "if" and the ShellExec api.
...
Admin
It's called bogosort. If the shuffling is truly random, you have a pretty good chance of completing, although it's not technically guaranteed, and it likely won't be any time soon. Consider: the probability of *not* getting the right permutation each try is (slightly) less than 1. So the likelihood of failing n times is (probability of failure)^n. Given a large enough n, it becomes extremely likely that the algorithm will complete.
Of course this is not absolutely guaranteed in finite time since it never quite goes to zero -- in fact, your computer is pretty likely to die of hardware failure or maybe the sun will go nova long before it produces a result -- but you are in a way making "progress" towards a solution even if the individual odds don't change.
Admin
Ehm? I would really wanna see you enter a job interview being asked to write a sort algorithm right at that moment, which you offcourse still know from memorising it 10 years ago at school... Right...
I'm not the memorising type of person, and I NEVER memorised a sort algorithm. Is it that hard to write? Even the slightly more complex quick-sort isn't that hard to reconstruct/rethink once you understood how it works. Adding to the specs that it shouldn't depend on the programming language's call-stack would add a need for small level of the need to understanding how things work (TM), but it still isn't rocketscience.
Bubble, ripple & most other sort algorithms are no-brainers. I had more trouble at school studying which name belonged to which algorithm than with the algorithms themselfs...
That said, if it was in plain C or C++, qsort is present in stdlib.h and is part of the standard C libraries afaik :) It takes what - 5 mins to write a program using it? :D
Admin
In fact, by the second Borell-Cantelli Lemma, bogosort will complete in finite time. It's just that you don't know for sure how long it'll take. But you do know it won't run forever.
Admin
What I want is people who are more interested in writing maintainable code than in proving their superior knowledge. I want someone who can look at a convoluted class hierarchy with lots of copy,paste&modify coding and work out how to slash 80% of the code without losing any functionality. I do NOT want someone who thinks Duff's Device is something that should actually be used in production code. If you define intelligence as a compulsion to reimplement standard functionality just because you think you can do it a bit better and show off your knowledge in the process, then yes, I'd rather have stupid programmers.
Admin
In real life software development you actually rarely need any clearly definable algorithms at all, apart from the most basic stuff like sorting and searching. But you need the ability to write maintainable code all the damn time. These a separate skills and of course ideally you have both, but when it comes to which is more important, I'd have to go with maintainability; obviously, the hacker mentality disagrees.
Admin
There NOTHING a infinite amount of monkeys can't code randownly typing a keyboard. [insert infinite amount of monkeys joke here]
Admin
Only for large values of "forever".
Admin
I guess the students heads, if not the professor's, would have exploded if they dried to figure out how to use an OLE component to simulate a datastructure in VB6, much less write one by hand.
There's downloable versions of queues, stacks and B-trees out there--with source, but I guess the professor wasn't smart enough to Google for that.
Admin
That's true. A much better algorithm would be to enumerate all the permutations of the array and iterate through them to find the one that is sorted!
Admin
This reminds me of when I was a guest lecturer at RIT in the advanced C++ class. The students at the time were working on data structures and understanding how a linked list worked and how forward and reverse traversion using next/prev pointers worked (Note: The class was called 'Advanced' but to me this topic should have been 'Intermediate' at most) ... They were using VC++6 and the professor was indeed using GUI components as a way of teaching sorting, etc. His theory was that VC++6 was used by every major corporation and that Linux and UNIX would not survive, so learning how to do it without using GUI components was moot.
Note that by this point VC++6 was already considered obsolete because of its lack of standards support, as much as MS supports the C++ Standards anyways, but the C++ Standard Library was finalized and public by this point and compilers such as Borland C++ and GCC were supporting it.
I asked the Professor if he had any intentions of teaching the students the C++ Standard Library at all, and got a funny look ... Turns out he had no idea it existed, assumed when he saw students using things such as 'std::queue', 'std::vector', 'std::list', etc, that they were just using some third party lib to sneak by and so was failing them. I spent an entire afternoon with this guy explaining the standards to him, showing him various web sites on it, etc, before he finally believed that it even existed, so I postponed my lecture to the students by 2 weeks to give him time to propagate this new information to the students (Note: Most of the students already knew it existed and wanted to use it).
The big WTF is when I finally went back to give the lecture, he still had the students using pseudo linked lists, but instead of having a stand alone linked list, he had them use an std::vector of instances of a structure that stored an iterator to the previous and next elements in the vector (Atleast he had them supporting std::vector::end() and std::vector::begin()), and a 'void *' pointer to stack variables declared and defined in 'main()' because he though that with std::vector being a templated class, it wouldn't be able to hold classes that contained non-pointer members ... Don't ask me how he came to this conclusion, but I laughed real hard after he finished explaining it ...
So in the end I ended up bringing in a computer loaded with FreeBSD and the latest GCC at the time, and had students SSH into it to do development testing, and had the professor take a seat amongst the students and spent a week (At no cost to the university) of 3 hour classes, 2 classes per day, teaching him and the students about templated classes, C++ Standard Library containers, etc. Its amazing what they let some professors get away with teaching, knowing, and better still NOT knowing, these days.
Admin
That's called undead. Zombies have no soul.
Admin
Ummm...what part of "visible=false" don't you understand?
Admin
You don't have to memorize each line of code, as long as you have a general idea of how they work you should be able to recreate the algorithm without much difficulty. And it is important to have a general idea of how these things work, just knowing that you can call a list.sort() which magically does some stuff doesn't help you when you encounter another problem which can be solved using some of the same techniques (such as merging or partitioning) used in these sort algorithms. Besides, its the most basic problem asked in any data structures/algorithms class, so you should know it anyways.
Admin
As has already been pointed out by the person who posted your message before you, it's not just slow it's unbounded! O(infinity)?
In BASIC class in highschool our teacher went around the room asking each student for a random number from 1-20 out loud to populate an array of 1-20 in random order. The number I had wanted to pick had already been taken, so I picked it anyway to demonstrate how bad the algorithm was. (Pick a random number, see if it's in the list, if it is pick a random number and see if it's in the list...)
Admin
What a GREAT analogy!
{The VB opponents would also say that the phone is rotary}
Admin
Well, inserting into a sorted array involves a search, then a shift of the entire array. Sure, this is still O(n), but if the array is huge, that shift might take awhile, especially if you are inserting in the front on a very large array. Second, when you fill up the allocated array, you will have to allocate a new one, and copy the elements to the new location. So, while you might be proud of your big-oh theory in comparing a linked list to a sorted array, I think you will find in reality, that sorted array you are using is slower (Perhaps you should consider one of the various tree structures). Of course, proper analysis should always be done when considering any particular data structure...they all have trade-offs and work better or worse in different situations
Admin
... Devry has an .edu? They're ..... accreddited?!? Wha .. how ... who .... *sigh*. I've lost a lot of faith in the Accreditation process ...
Admin
Obviously, the professors at WTF-U didn't need to. He, he, he.
dZ.
Admin
Heh, I thought I had it bad when we were forced to use Haskell for a time (that's right Haskell not Pascal), but at least they taught us pointers as well.
Admin
Pointers are not the same as references, and more to the point, as array indexes. If we were talking about any other language that actually support pointers, then the array index would be an *OFFSET* added to the POINTER (which is actually pointing to the beginning of the array, not to each element), in order to get to the memory address of a specific element.
A pointer is a data structure that points to a specific physical memory location address. A reference, on the other hand, is an abstraction of a pointer: it is a higher-level data structure that references another, independently of where it is physically stored in memory.
-dZ.
Admin
Vampires, zombies, and other ghouls never die, too, yet have no soul.
-dZ.
Admin
Now, if they force you to use their own home-grown STL, or the one that came with a book -- or any algorithm direct from a book -- then you should worry. Bookwriters get paid for writing books, not writing good code, or even working code...
Admin
From my very narrow window of experience I would say that most cluttered code is made by copy/paste freaks who google around and write programs by adding mammoth-programs with massive overheadcapabilities together. I have been thaught to make a program and then try to scrap things in it, or replace them with shorter versions. the shorter version may of course be a librairycall, because we may hope to expect that those ace-programmers writing the librairies aren't copy/paste-clutterheads.
But still I like to write my own methods/classes/etc. just for fun (since I'm an amateur and not paid for using librairies, I guess that's my good right...). Or because the librairies are ill-documented and I don't have the time to scroll over 30 pages of code to find out how to get the damn thing running.
Admin
Yes, they are accredited, however you'll find that if you attend there and try to transfer to another school, LITTLE to NONE of your DeVry classes transfer due to the way they are structured 'differently'.
During the registration process I actually had to lie and say that my parents were deceased, because they refused to admit me without complete information on them (including SS#), even though I told them repeatedly that I was paying in cash, ahead of time, and I was 25 at the time... they had to get this information, because they do a hard-sell to high school students to get them to sign up, and the high school students often leave without paying their bills (because they are not qualified to be learning whatever they've signed up to learn, or they are smart enough to figure out what you don't learn at DeVry). There were many, many other WTF's I experienced at DeVry, and most of them seemed to be designed to guide sheep by the nose through the hallways of "Getting your Extremely Valuable Computer Science Degree."
It wouldn't have been so bad, except their tuition is horrendously expensive - about 10% more than the private liberal arts school I transferred to. There is a local community college that, while it does not grant BS/BA degrees (only Associates), actually does a much better job at educating its students at 1/6th of the cost of DeVry.
My advice to aspiring developers? Go to a liberal arts school and dual-major in Philosophy and CS (or minor in Philosophy) for a strong foundation in logic and asking all the pertinent (and even some un-pertinent) questions. Learn how to communicate well. Read books such as "Buck Up, Suck Up... and come back when you foul up" (Carville, Begala) and "How to win friends and influence people" (Carnegie) to learn how to be persuasive and get what you want. In this day and age, you need to communicate well and be persuasive - the Philosophy degree will help with that - as well as knowing the ins and outs of bubble and raadix sorts.
Cheers,
-Josh
Admin
You have a point there but to be anal you can use pointers in VB.
VB has the undocumented VarPtr(), StrPtr() et al functions that give you access to the address of a variable. Then the not-so-hard but slow way to manipulate memory is with the MoveMemory API function. However, the fast yet obtuse way is to set up a phoney SAFE_ARRAY structure. Of course you'll have to understand VB's internal structures so make sure you don't comment the code so that future debuggers heads will explode. With SAFE_ARRAY you can deal strictly with pointers provided you know the internal codes for different data types.
Admin
If this presentation was taken from Princeton, shouldn't someone take that university of the 'best university' list?
Admin
The only question I have here is, "Does this top Paula Bean?"
Admin
I had sort of the opposite experience at one job interview in the distant past. They wanted an "Object Oriented" developer who knew how to work with relational databases. They asked me write some code that could read a table and write it out into a CSV file, and possibly other formats too.
I wrote some simple objects that queried a database table, linked to some format adaptor objects to allow CSV, XML, or whatever, to be pumped out.
I didn't get the job. Apparently I hadn't used the "right objects". Apparently, being "object oriented" means re-using other people's components! They wanted me to use ADO, and my "ad hoc design" just didn't cut their mustard. It's a shame I wasn't psychic too (especially as if I could have read their minds, I wouldn't have bothered finishing the interview!).
Incidentally, I also asked them whether they wanted to see quick results or a better implementation for this test. The manager answered "both" and wouldn't budge on that.
Admin
At my first programming job (student worker college), I had to use VB3 because we needed to ensure that the application could fit on a floppy and we couldn't count on every client having the VB4 runtime dlls.
off topic, since the captcha is random, I had a CS professor that broke his arm... during lecture. He was also late to at least one midterm test because he was too busy writing the test.
Admin
I did economics, though I am systems analyst/programmer even before college. Despite that, I can remeber a few sorting alghoritms and implement then in any language I work with. Is not a question of memorization, but of understanding. Once you understand, you'll never ever will have to remember a boiler-plate implementation.
Admin
Ada has pointers. They're called "access types."
C is only confusing to someone with little or no understanding of how a computer works. It's closer to programming at the hardware level than a strongly-typed language like Ada. Very little is abstracted by default. That's why it's still the preferred language for things like driver development.
When I was in school, the beginning CS classes were taught using Pascal. It also has pointers, but I didn't really understand them until I took my first computer architecture class and we talked about memory structure. After that, I taught myself C and C++ with a couple of O'Reily books and a copy of gcc.
Admin
A quick example: try using libcrypto from OpenSLL without having at least a superficial understanding of how the alghoritms work.
Am I going to write my own crypto library? Hell! no! Would I trust code written by people who have not the slightest idea of how the library they are using could be possibly implemented by themselves? Hell! NO!!!
Admin
Some people that administer interviews are pure genius! ... Being a lead developer now, I interview potential candidates for the company I work for. What I do is tell people coming in for an interview to plan on spending atleast three hours here. I conduct a generic interview, get more background, etc, then I sit them down in front of a computer with a compiler, no internet access, and a link to a testing DB Server. I give them an hour and a half to write a program that can communicate with both MySQL and SQL Server databases, uses sockets, supports some cross-platform GUI stuff (Usually using QT and/or wxWidgets though primarily QT), etc ... I never expect perfection and I know people get nervous .. I am usually looking at coding style, use of objects, flow control, things of that nature. For the last part of the interview I have them walk me through their code, explain why they did what they did, what their intentions were, what they felt they could do better on if they had more time, etc.
Admin
I took a course like this in college. They also used vb6 and you can create stacks, queues, linked lists no problem in vb6 (even though i still think its a bad choice). This prof should be terfed.
Admin
Wow... Maybe I was wrong... Maybe the problem with CS degrees today are the teachers...
Admin
Umm... I think you just did... (randowned?)
Admin
If you went to DeVry thinking you were getting a CS (meaning Computer Science) degree, you are part of the problem. You fail at life.
Did you sign up for a CIS course of study by mistake?
For what its worth, becoming a hands-on technician is what this school is good for. Very little theory, but practical training for the here and now. I can only speak for my EET Degree, but getting access to the HPVEE software, agilent digital oscilloscopes, matlab, PLC's, and CPLD's was only possible for me at this school.
Don't badmouth the obvious easy target just because you're misunderstanding what degrees they actually offer. You can get rifraff from almost any "accredited" university or technical college.
Admin
Admin
You couldn't be more correct. The trouble is that today professors (especially the CS ones) are pressured so heavily on their research. This inevitably makes teaching the students a low priority. Which is why they often try to steal notes from someone else and then just read them aloud during class. Often turning down all questions and refering the student to a (even more useless) T.A. was not that uncommon either. And to make matters worse, the good profs are usually the new ones, but since the POS profs usually have tenure, they get to stick around and the new guys get canned. Very unfortunate situation for any CS student.
I can't verify this type of behaviour all over the world as I am only one student at my home town U. However, I would not be suprised if conditions are similar elsewhere. The solution (as my university has begun to adopt) is to lock down notes. Starting last year, my U required semesterly changing passwords to access any course material other than general information such as synopsis or class times. This deters the use of "stolen" notes. Additionally, professor evaluations are a must, hopefully they will not be simply thrown away as they have been in the past. Finally, a student-department curriculum committee. This committee gives the opportunity to students to circumvent the professors and voice their oppinions about the class material and the professor "sans censorship." Currently, we have begun to implement these steps at my U, it is too soon to tell if this will make a difference, but I have high hopes of its success.
Pat
Sick of undeserving CS degree holders
captcha = Tony Clifton: Andy Koffman
Admin
You are silly. I knew exactly what degree I was going in for; at that point in my life I just wanted a Bachelor's that I could breeze through - and given that, at that point I had developed professionally for 5 years (and 'unprofessionally' since I was 9 years old) I thought I could breeze through it. I'm not saying that everyone who attends DeVry is rifraff; but I suspect there is a far greater percentage of it at DeVry than most other schools.
The very first WTF I experienced there was during the registration process. At the point I had decided to attend DeVry, I called an admissions person and scheduled a meeting to sign up. When I got there, after filling out the application, he said that there would be a "discussion" to see if I was "right" for the school. I told him that none was needed - I wanted to sign up now - but he persisted. Ok, whatever.
Going by some sort of script, he proceeded to use almost exactly the same method to sell the school to me, that I had used in years past to sell cars. I realized this, 3 points into a 10 point script, and told him: "I know what you're going to say; let's sign up." He still persisted, and I asked again. Finally, I told him that I would rip up the app and deposit check and walk out unless he stopped - and he did.
Think about it: if their "admissions" reps are using the same tactics to sell the school to high school students (and generally everyone), that salesmen use to sell cars - and then, as you said above, teach people very little theory, instead focusing on the 'here and now' - what kind of people do you expect they attract, and what do you expect the results would be?