Normal quotes
This commit is contained in:
parent
5e10794a24
commit
18011c595a
352 changed files with 6040 additions and 6040 deletions
18
15-03.md
18
15-03.md
|
|
@ -12,7 +12,7 @@
|
|||
containing the largest possible Value field setting and pointing
|
||||
to itself as the next node. */
|
||||
#include <stdio.h>
|
||||
#include “llist.h”
|
||||
#include "llist.h"
|
||||
struct LinkNode *FindNodeBeforeValueNotLess(
|
||||
struct LinkNode *HeadOfListNode, int SearchValue)
|
||||
{
|
||||
|
|
@ -35,19 +35,19 @@ One minor but elegant refinement yet remains: Use a single node as both
|
|||
the head *and* the tail of the list. We can do this by connecting the
|
||||
last node back to the first through the head/tail node in a circular
|
||||
fashion, as shown in Figure 15.5. This head/tail node can also, of
|
||||
course, be a sentinel; when it’s necessary to check for the end of the
|
||||
course, be a sentinel; when it's necessary to check for the end of the
|
||||
list explicitly, that can be done by comparing the current node pointer
|
||||
to the head pointer. If they’re equal, you’re at the head/tail node.
|
||||
to the head pointer. If they're equal, you're at the head/tail node.
|
||||
|
||||
Why am I so fond of this circular list architecture? For one thing, it
|
||||
saves a node, and most of my linked list programming has been done in
|
||||
severely memory-constrained environments. Mostly, though, it’s just so
|
||||
*neat;* with this setup, there’s not a single node or inner-loop
|
||||
severely memory-constrained environments. Mostly, though, it's just so
|
||||
*neat;* with this setup, there's not a single node or inner-loop
|
||||
instruction wasted. Perfect economy of programming, if you ask me.
|
||||
|
||||
I must admit that I racked my brains for quite a while to come up with
|
||||
the circular list, simple as it may seem. Shortly after coming up with
|
||||
it, I happened to look in Sedgewick’s book, only to find my nifty
|
||||
it, I happened to look in Sedgewick's book, only to find my nifty
|
||||
optimization described plain as day; and a little while after *that,* I
|
||||
came across a thread in the algorithms/computer.sci topic on BIX that
|
||||
described it in considerable detail. Folks, the information is out
|
||||
|
|
@ -65,7 +65,7 @@ illustrates the use of the linked-list functions in Listings 15.1 and
|
|||
|
||||
Contrast Figure 15.5 with Figure 15.1, and Listings 15.1, 15.5, 15.6,
|
||||
and 15.7 with Listings 15.3 and 15.4. Yes, linked lists are simple, but
|
||||
not so simple that a little knowledge doesn’t make a substantial
|
||||
not so simple that a little knowledge doesn't make a substantial
|
||||
difference. Make it a habit to read Knuth or Sedgewick or the like
|
||||
before you write a single line of code.
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ before you write a single line of code.
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include “llist.h”
|
||||
#include "llist.h"
|
||||
/* Initializes an empty linked list of LinkNode structures,
|
||||
consisting of a single head/tail/sentinel node, and returns a
|
||||
pointer to the list. Returns NULL for failure. */
|
||||
|
|
@ -94,7 +94,7 @@ before you write a single line of code.
|
|||
return(NULL);
|
||||
Sentinel->NextNode = Sentinel;
|
||||
Sentinel->Value = SENTINEL;
|
||||
strcpy(Sentinel->Text, “*** sentinel ***”);
|
||||
strcpy(Sentinel->Text, "*** sentinel ***");
|
||||
return(Sentinel);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue