• Forum
  • Lounge
  • What are the most F.A.Q on this forum? (

 
What are the most F.A.Q on this forum? (part 2)

Pages: 12
This is a continuation of the archived thread twicker posted here:
http://www.cplusplus.com/forum/lounge/60389/

I am struggling with the sorting algorithms page:
http://www.cplusplus.com/faq/sequences/sequencing/sort-algorithms/

As it is, I am unsatisfied with the overview of the algorithms; in particular, I am unhappy with the algorithm descriptions.

I was in the process of converting them to a simpler explanation using some mathematical notation... but then it occurred to me that, simple as it is, it might be confusing or off-putting to a large portion of the people trying to figure this out for the first time.

I am also not convinced that my efforts are any better than information available over on Wikipedia. (Though I like my Bubble Sort algorithm description better... Maybe I should just update the wiki with an "in a nutshell for dummies" kind of spot?).

The basic aims of the page should be to help people do two things:
1. understand the basic algorithm
2. choose an algorithm to use

Additional information may include pointers for efficiently implementing the algorithms in C and C++, especially in terms of iterated sequences, and restrictions that may involve.

@Albatross
Since you designed the original of this (much modified since), do you have any particular ideas? Did I lose anything you wanted in particular?

Google's crawler is already picking some of the FAQ pages up, so I want to make sure that the info is as professional and useful as possible...
Last edited on
Do people really ask which sorting algorithm to use that often?
KISS (can't think about evil bubble)

Considerer having two sets.
Selection sort:
_ Take out the elements in order. By instance, always take the smallest remaining element.
But that element to the end of the "sorted" set.

Insertion sort:
_ Take an element, put it were it should be.
Note: it is an online algorithm.


Merge sort (great with lists)
_ There are two parts: divide and merge.
_ Division: divide the set in two "equal" parts. Do it until you get sets of size 1.
_ Merge: iterate both sets, at each step take the smallest and put it in a sorted one.
Repeat until you get only 1 set.

Something like that.
Anything about "undefined reference". Over and over and over :p

I knocked a post I had here somewhere into a "How to use gdb" article a few days ago.
Well, having rethought it pretty carefully, I think I have made some progress with the overall structure. (At least, the first part of the page, anyway...)

@ResidentBiscuit
Yes. And the more you get paid, the more important the question becomes.

@ne555
Yes, I like. :O)

@Moschops
Er, what? Are you saying that I should include something about debugging when the user has out-of-bounds errors?
Wouldn't be a bad idea, to be honest, or to at least include something on what a segFault is, the most common reasons for it, and how to track it down (i.e. how to use gdb or chosen alternative). I definitely see "undefined reference" and "what's an ACCESS_VIOLATION" a lot in questions.
Oh, you are talking about a general FAQ question and not the sorting algorithms?

Let me go and add it to the list... done. It is FAQ number 84. Now that I have access to my webspace again, I'll have to add a page that documents how I am doing for you all. (I've got it in a text file ATM.) I'll post back later once I can do that. (I have to stop for the night.)
Personally I found that being able to see how elements are selected and moved around to be the best aid for understanding a sorting alrogithm.
I think it's time to separate the actual C++ FAQ from the basic computer science course. Simplify your work by leaving the in-depth coverage of algorithms to Wikipedia?

Also typo at: http://www.cplusplus.com/faq/sequences/strings/ci-compare/
If not, you&srquo;ll need to convert your (Unicode) strings

@Ikaron
Thanks.

@Catfish2
That is a very good point.

However, Wikipedia is not the most understandable of sources for the initiate, and sorting algorithms are typically studied in the first couple of years at the university. I was only thinking to provide a more approachable introduction, and then link to Wikipedia?

Hmm...

The case-insensitive comparison page's content will be replaced once I rethink it... ATM it is just trash.
Totally agree Duoas, Wikipedia has a terrible tendency of being written by the experts for the experts, and not to the bigger audience of novices.

Well, in CS at least, as far as I can tell most of the Maths is written by engineers and scientists doing a lot of statistics.

EDIT: I've had a quick read through the FAQs and they're great, and in my opinion what Wikipedia's articles should be like if they were hoping to be more helpful!
Last edited on
Try Simple English Wikipedia (change the 'en' to 'simple') or look for 'Introduction to...' articles.
Even so, I want the FAQ to be as widely useful as possible... catering toward the beginner if it makes a difference.

I don't tend to like the "simple" Wikipedia -- as often as not I find the articles to be incomplete or less useful than their full counterpart. For example, the Bubble Sort entries:
http://en.wikipedia.org/wiki/Bubble_sort
http://simple.wikipedia.org/wiki/Bubble_sort

Both entries share the same problems. The "simple" version uses smaller words (which does actually make it more readable to most people), but it shares the same flaws. In particular, the bubble sort algorithm is actually not as easy to understand as some of the more "advanced" algorithms, like insertion sort, because people don't naturally think the way computers do; bubble sort thinks the way computers do.

The full entry actually does a better job of explaining the algorithm because of the additional stuff, particularly the animated GIFs. The "simple" page uses the same example text, but that example is not really that easy to follow, in large part just because it is a large list of numbers with parentheses here and there. I know that doesn't frighten most of us, but we are an unusual group. Most people will not even bother. (It's sad, I know.)

Finally, the "simple" page just gives you actual code. It makes no effort to help you understand what it is actually doing. Hence, it is more difficult to reason about because of the extra language fluff invoked by bogging down in Java details. (But hey, what language is that anyway? What does i++ mean?). People don't need micro details to understand an algorithm. Simply saying that you are done after going through a loop without swapping anything is enough -- because that's how human brains work (not computers).

Anyway, those are some of the things in my head.
Yeah, you're right.

The 'Introduction to...' articles are usually good though. I don't know what topics they're for, as the only ones I've seen were for things like General Relativity and that sort.
Well, the bubble sort is done.
http://www.cplusplus.com/faq/sequences/sequencing/sort-algorithms/#bubble-sort

The Wikipedia anim i don't entirely like... since it leaves out some of the bubbling...
Last edited on
All this sorting algo talk made me think of these guys, who make dances out of sorting algorithms. xD http://www.youtube.com/user/AlgoRythmics
Bucket sort is done.
http://www.cplusplus.com/faq/sequences/sequencing/sort-algorithms/#bucket-sort

I made the graphic myself. Tell me what you think.

(BTW, you must technically use another algorithm to sort the buckets because if you degenerate bucket sort to do it it becomes a simple counting sort.)
Looks good. Graphic is an excellent visualisation of the sort.
I have a language question. I personally tend to double the L when writing words like "travelling". This is, according to the internet, something of an English way of doing it, where here in the states people tend to say "traveling" (notice the one L).

I want to be consistent. Pros to one L: easier to read. Cons: looks weird?

Any English majors here?
Either way is correct. I think two L's is probably the officially correct way to do it, though. If we follow rules of English (which are laughable), two L's is correct, but either one is acceptable.
Pages: 12