# Web Development

## General discussion

Locked

### Algorithms

By ·
Can Someone please explain to me in Lamens' terms, as i have very litlle to no programming experience, what the following algorithms do.
The algorithms are:

Binsort, mergesort, bubblesort, quicksort, insertsort, selectsort

When they would bebest used, what for? etc. Also which values if any they would be better suited to being used with.

Many thanks

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

Collapse -

### Algorithms

I am not a programmer either, so I only have a few of the definitions for you.
Bubblesort - A sorting technique in which pairs of adjacent values in the list to be sorted are compared and interchanged if they are out of order; thus, list entries "bubble upward" in the list until they bump into one with a lower sort value. Because it is not very good relative to other methods and is the one typically stumbled on by naive and untutored programmers, hackers consider it the canonical example of a naive algorithm. The canonical example of a really *bad* algorithm is bogo-sort. A bubble sort might be used out of ignorance, but any use of bogo-sort could issue only from brain damage or willful perversity.

Quicksort - sorting algorithm with O(n log n) average time complexity.

One element, x of the list to be sorted is chosen and the other elements are split into those elements less than x and those greater than or equal to x. These two lists are then sorted recursively using the same algorithm until there is only one element in each list, at which point the sublists are recursively recombined in order yielding the sorted list.

This can be written in Haskell:

qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort (x:xs) = qsort ++
[ x ] ++
qsort

Others here will have the rest of the definitions.
hope this helps

Collapse -

Collapse -

Collapse -

Collapse -

### Algorithms

In layman's terms, not in programming terms, the algorithms are all used for sorting data. When you are in Excel and want to sort the values in a column by going to Data->Sort, it's using one of these algorithms or something similar.

The difference between them is the approach they take to sorting. One just compares adjacent items, resorting them one at a time until the whole list is sorted, one splits the list into two parts, splits the parts into two each, all the way until you can't sort any more, then sorts the split up pieces and stiches them back together. There are other strategies in the other algorithms.

Obviously they're all best used for sorting data, but you probably want a more specific answer. That would require getting into some technical detail that would go beyond layman's terms. I can say that the details of some algorithms make them better for sorting some types of data sets - each algorithm has a "best case", "worst case", and "expected case". If yourset of data is expected to be similar to an algorithm's "best case", then you'll probably get good performance by using that algorithm.

When you see some people refer to the complexity of an algorithm with an expression like "O(n log n)", that's computer science notation. It means that on average, we expect this algorithm to take n * log n units of time or steps to complete. n in the case of sorting algorithms is the number of pieces of data to be sorted. log is a base 10 logarithm (pull out your old algebra book!). Basically, the big-O notation allows us to talk about the performance of an algorithm independent of the hardware or sotware that it's implemented on.

Good luck.

Jay

Collapse -

Collapse -

### Algorithms

In a merge sort one takes 2(or more) lists sorted on the desired criteria and merges them taking account of the sort criteria; the result is automatically sorted. If one starts with an unsorted list of n atoms, one considers it as n/2 lists of 2 atoms, swaps within any list where the atoms are out of order, and then has n/2 sorted lists, which may be paired into larger lists until by successive meregesort one reaches the complete list sorted.

Collapse -

Collapse -

### Algorithms

This question was closed by the author

## Related Discussions

• 12

• 23

• 5

#### Every time I upload a plugin, then the next time my site does not open.

spencer1621515293 ·

• 2

#### javascript code showing all over page, when using Header and Footers plugin

spencer1621515293 ·

• 2

quest4code ·