◅ HELP! Are dynamically allocated static arrays possible?

# Need Bubble Sort algorithm...

In article <01bc23f6$fe207c00$1008578a@6609hxf2p383>, Chuck Little <cwlittl@odin.cmp.ilstu.edu> wrote: >I need to do a bubble sort [...] Why? Insert sort is a more obvious algorithm which performs better. I've never understood the fascination with bubble sort. (Oh, the bubble sort algorithm (for a 0 based array of n elements, so the last element is n-1), roughly: look at the first pair of elements (0 and 1), swap them if they are out of order; look at the next pair (1 and 2), swap if out of order. Continue up to the last pair (n-2 and n-1). After the first pass, the last element (n-1) is correct. Start with 0 and 1 again; this time stop after considering n-3 and n-2. Now the last two elements are correct. Repeat till you're done. As a minor optimization, you can stop if a single pass involves no swaps.) Tim. -- Tim Goodwin | "A language needs both intestines and guts." -- Larry Wall

Original headers:

From: tim@pipex.net (Tim Goodwin) Newsgroups: comp.lang.c Subject: Re: Need Bubble Sort algorithm... Date: 26 Feb 1997 17:25:44 GMT Organization: UUNET PIPEX Message-ID: <5f1rmo$dsk@join.news.pipex.net> References: <01bc23f6$fe207c00$1008578a@6609hxf2p383>