home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / c / 11785 < prev    next >
Encoding:
Text File  |  1992-07-30  |  1.7 KB  |  41 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!stanford.edu!CSD-NewsHost.Stanford.EDU!Xenon.Stanford.EDU!amorgan
  3. From: amorgan@Xenon.Stanford.EDU (Crunchy Frog)
  4. Subject: Re: array element swap help
  5. Message-ID: <1992Jul30.220758.14925@CSD-NewsHost.Stanford.EDU>
  6. Sender: news@CSD-NewsHost.Stanford.EDU
  7. Organization: Computer Science Department, Stanford University.
  8. References: <1992Jul30.161648.26055@news.iastate.edu> <1992Jul30.185540.10776@CSD-NewsHost.Stanford.EDU> <1992Jul30.203049.2800@klaava.Helsinki.FI>
  9. Date: Thu, 30 Jul 1992 22:07:58 GMT
  10. Lines: 29
  11.  
  12. In article <1992Jul30.203049.2800@klaava.Helsinki.FI> 
  13.   wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) writes:
  14. >amorgan@Xenon.Stanford.EDU (Crunchy Frog) writes:
  15. >>Oh, there is no real way to speed [swapping] up [...]
  16. >
  17. >The best way to speed it up is to eliminate it altogether.  
  18.  
  19. Huh?  Maybe the constant drug use is getting to me, but I don't see how
  20. you can do that.  Sure, you can reduce it by using a better sort
  21. (as you say below), but to sort things you have to change their position.
  22.  
  23. >The problem
  24. >arose for a sorting application, so perhaps there is a better sorting
  25. >algorithm that could be used (use Quicksort instead of Bubble sort).
  26.  
  27. Agreed.  I said the request  seemed a little weird.
  28.  
  29. >On the other hand, if the array elements are large (some kinds of
  30. >structures, say), you can probably speed things up by using an array of
  31. >pointers to said structures instead.  The purpose is to make the array
  32. >elements smaller and thereby reducing the amount of data that has to be
  33. >moved.
  34.  
  35. Yep.  I alluded to this in my posting, but since I wasn't sure what
  36. the original poster was up to I didn't bother specifying it.
  37.  
  38. >Lars.Wirzenius@helsinki.fi
  39.  
  40. C Frog
  41.