home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!news.funet.fi!hydra!klaava!wirzeniu
- From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius)
- Newsgroups: comp.lang.c
- Subject: Re: array element swap help
- Message-ID: <1992Jul30.203049.2800@klaava.Helsinki.FI>
- Date: 30 Jul 92 20:30:49 GMT
- References: <1992Jul30.161648.26055@news.iastate.edu> <1992Jul30.185540.10776@CSD-NewsHost.Stanford.EDU>
- Organization: University of Helsinki
- Lines: 15
-
- amorgan@Xenon.Stanford.EDU (Crunchy Frog) writes:
- >Oh, there is no real way to speed [swapping] up [...]
-
- The best way to speed it up is to eliminate it altogether. The problem
- arose for a sorting application, so perhaps there is a better sorting
- algorithm that could be used (use Quicksort instead of Bubble sort).
-
- On the other hand, if the array elements are large (some kinds of
- structures, say), you can probably speed things up by using an array of
- pointers to said structures instead. The purpose is to make the array
- elements smaller and thereby reducing the amount of data that has to be
- moved.
-
- --
- Lars.Wirzenius@helsinki.fi
-