User Tools

Site Tools


haas:fall2015:data:projects:dll2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
haas:fall2015:data:projects:dll2 [2015/11/08 10:30] – created wedgehaas:fall2015:data:projects:dll2 [2015/11/08 13:34] (current) – [list library] wedge
Line 37: Line 37:
 To implement **qty**, all list functions that perform manipulations to the list will need to see some updating (**mklist()**, **insert()**, **append()**, and **obtain()**). Functions like **cplist()** should be using the aforementioned functions to manipulate the list, so it does not need any changes (if your **cplist()** is redundant, it will need to see changes to ensure compatibility). To implement **qty**, all list functions that perform manipulations to the list will need to see some updating (**mklist()**, **insert()**, **append()**, and **obtain()**). Functions like **cplist()** should be using the aforementioned functions to manipulate the list, so it does not need any changes (if your **cplist()** is redundant, it will need to see changes to ensure compatibility).
  
 +====list library====
 +Again, in **src/list/**, you are to add support for **qty** so that, just as the list's **first** and **last** maintain an accurate positioning of their respective aspects of the list, **qty** maintains a count of the total number of nodes still in the list.
 +
 +===display() enhancements===
 +You are also to implement 4 additional modes to the display() function. 
 +
 +Be sure to adjust any mode error correction accordingly.
 +
 +The modes are as follows:
 +
 +<code c>
 +//////////////////////////////////////////////////////////////////////
 +//
 +// Options for list display() and support catlist() functions
 +//
 +#define  DISPLAY_FORWARD     000
 +#define  DISPLAY_NOPOSVALS   000
 +#define  DISPLAY_NOASCII     000
 +#define  DISPLAY_SEPS        000
 +#define  DISPLAY_POSVALS     001
 +#define  DISPLAY_BACKWARD    002
 +#define  DISPLAY_ASCII       004
 +#define  DISPLAY_NOSEPS      010
 +</code>
 +
 +What has changed? There are two additional toggles:
 +  * NOASCII/ASCII - whether or not to render VALUE as an ASCII character or a number
 +    * in ASCII mode, separators become commas, and the terminating NULL no longer is output
 +  * SEPS/NOSEPS - whether or not to display arrows/commas or nothing at all
 +
 +For example, if there was a numeric 65 stored in the node, with DISPLAY_ASCII set, an **'A'** should be displayed instead of a **65**.
 +
 +==display() output examples based on mode==
 +Let's say we have a list with the following elements:
 +
 +  first -> 51 -> 49 -> 51 -> 51 -> 55 -> NULL
 +
 +==forward, no positions, with separators, as numbers (not ASCII)==
 +<cli>
 +51 -> 49 -> 51 -> 51 -> 55 -> NULL
 +</cli>
 +
 +==forward, with positions, with separators, as numbers (NOT ASCII)==
 +<cli>
 +[0] 51 -> [1] 49 -> [2] 51 -> [3] 51 -> [4] 55 -> NULL
 +</cli>
 +
 +==forward, no positions, with separators, in ASCII==
 +<cli>
 +'3' -> '1' -> '3' -> '3' -> '7' -> NULL
 +</cli>
 +
 +==forward, with positions, with separators, in ASCII==
 +<cli>
 +[0] '3' -> [1] '1' -> [2] '3' -> [3] '3' -> [4] '7' -> NULL
 +</cli>
 +
 +==forward, no positions, no separators, in ASCII==
 +<cli>
 +31337
 +</cli>
 +
 +Please see the unit test for more information.
 +
 +====List library applications====
 +
 +===cyclecheck===
 +A problem that cropped up from time to time during the list implementation was the instance of a list **cycle**, where a node accidentally ended up pointing to itself (or a previous location, to the direction of traversal). This led to seemingly "infinite loops" as streams of identical values displayed on the screen, and hopefully pictures drawn to try and track down the source of the problem.
 +
 +With the doubly-linked list functions (especially insert() and append()) we baked in additional resiliency by having them check the validity of their **place** pointers, to ensure that **place** was a legitimate node in the list.
 +
 +But we've not done anything to address the presence of cycles. Here we will explore how to detect them, and even attempt to ascertain where they start (source) and at what point the list repeats (destination) over and over again.
 =====Expected Results===== =====Expected Results=====
 To assist you in verifying a correct implementation, a fully working implementation of the node library, list library (with new modifications), and group library should resemble the following: To assist you in verifying a correct implementation, a fully working implementation of the node library, list library (with new modifications), and group library should resemble the following:
haas/fall2015/data/projects/dll2.1446978611.txt.gz · Last modified: 2015/11/08 10:30 by wedge