Article View: csu.cs.200
Article #171Re: help with sort.h
From: Michael Szczepaniak
Date: Tue, 15 Sep 1998 00:00
Date: Tue, 15 Sep 1998 00:00
40 lines
2173 bytes
2173 bytes
One small correction: The last line in the 3rd paragraph read: "...Based on this test, you either update next or not...." It should have read "Based on this test, you either update index or not." Sorry if this caused any confusion, Michael Sz. Michael Szczepaniak wrote: > Before playing with what I explain below, go through and make sure you know > exactly how the original SelSort function works. > > In the original Sort.h function, i, j, and index are used to index array > items. Even though nodes in an SLL are not numbered, you can pump i, j, and > index into your "Find Node N" function (see 9/8/98 class notes) and have the > function return a pointer that points to the ith, or jth etc. node. > > In the if-statement, you'll be comparing last names so you'll need the strcmp > function (in the <strings.h> header file) to be able to tell which last name > comes after which. Based on this test, you either update next or not. > > When it's time for the swap, I used the dummy node as the temporary swap space > (analogous to the "hold" variable). > > Someone please comment if this is appropriately "high level" enough or too > detailed! This all worked for me. You'll have the most fun with the output > function(s)!!! Hope this helped. > > Michael Szczepaniak > > Chris Vaughn-Uding wrote: > > > I'm kind of at a loss on how to modify the sort function. Anyone have some > > advice on how to substitute the name fields into the array positions. > > > > Chris Vaughn
Technical Details
Message-ID:
<35FF34E2.5B18962C@earthlink.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6tna64$83b8@yuma.ACNS.ColoState.EDU> <35FF32A8.8B105C9D@earthlink.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 127144,5a4956090ae5ec48 X-Google-Attributes: gid127144,public From: Michael Szczepaniak <mszczepaniak@earthlink.net> Subject: Re: help with sort.h Date: 1998/09/15 Message-ID: <35FF34E2.5B18962C@earthlink.net> X-Deja-AN: 391586349 Content-Transfer-Encoding: 7bit References: <6tna64$83b8@yuma.ACNS.ColoState.EDU> <35FF32A8.8B105C9D@earthlink.net> X-Posted-Path-Was: not-for-mail Content-Type: text/plain; charset=us-ascii X-ELN-Date: Tue Sep 15 20:43:08 1998 Organization: Eclectic systems Mime-Version: 1.0 Reply-To: mszczepaniak@earthlink.net Newsgroups: csu.cs.200