Path: utzoo!attcan!utgpu!watmath!att!dptg!rutgers!cs.utexas.edu!uunet!brunix!man From: man@brunix (Mark H. Nodine) Newsgroups: comp.sys.mac.hypercard Subject: Re: Sorting gets very slow Message-ID: <15849@brunix.UUCP> Date: 21 Sep 89 18:32:46 GMT References: <807taylorj@yvax.byu.edu> Sender: news@brunix.UUCP Reply-To: man@vali.UUCP (Mark H. Nodine) Organization: Brown University Department of Computer Science Lines: 18 In article <807taylorj@yvax.byu.edu> taylorj@yvax.byu.edu writes: >In message <14843@brunix.UUCP>, Mark complains about slow sorting on >large stacks. > >I recommend that you solve the problem by keeping the stack in sorted order. >When a new card is inserted you can do a binary search (which in large stacks Unfortunately, this won't work for my stack because I have several different backgrounds, all of which have a key field with the same name. When I need to create a new card, I suppose it is (barely) conceivable that I could go to the card with the same background that is closest in sorted order to where I want it to appear, but in general I can't just create it in the right place. Some of the n log n sorting algorithms become n^2 when the list is in "almost sorted" order. My stack is usually "almost sorted", so I wonder it that was the problem. --Mark