CSC161 2011S Imperative Problem Solving
[Skip to Body]
Primary:
[Front Door]
[Schedule]
[Piazzza]
-
[Academic Honesty]
[Instructions]
Current:
[Current Outline]
[Current EBoard]
-
[Current Assignment]
[Current Lab]
[Current Reading]
Groupings:
[Assignments]
[Documents]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
[Reference]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
[CSC161 2010F (Rebelsky)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
Summary:
Prerequisites: Familiarity with pointers, linked lists, malloc, and more.
a. Create a new directory for this lab. I would suggest something like
CSC161/Labs/Lists.
b. Make a copy of Examples/Lists/lists.tar.
c. Unpack that tarball in your directory.
d. Review the list.h file to make sure you understand which
functions the list library should provide.
e. Review the implementations of list_get (provided) and
list_index_of (written in class).
An important list operation is list_set(lst, n, val), which sets the nth element of lst to val.
a. Review the documentation for list_set so that you know
what it should do.
b. Write some simple unit tests for list_set. For example,
you might create a four element list of the word "Bravo" set
the second element to "Beta", and make sure that the second
element is "Beta" but the rest remain "Bravo".
c. Write some simple experiments for list_set. You might
create a four element list of the word "Bravo" and set
the second element ot "Beta"
d. Implement list_set.
a. Review the documentation for list_insert so that you know
what it should do.
b. Write some simple unit tests for list_insert.
c. Write some simple experiments for list_insert.
d. Implement list_insert.
a. Review the documentation for list_delete so that you know
what it should do.
b. Review the implementation of list_cut so that you
are comfortable with the strategy for removing elements from a list.
c. Write some simple unit tests for list_delete.
d. Write some simple experiments for list_delete.
e. Implement list_delete.
There are two common strategies for implementing list_delete.
One might delete a element by finding its index and using
list_cut. One might delete an element by iterating through
the list until one finds the element.
Pick whichever of these stratedy you did not use for the previous
exercise and implement list_delete using that strategy.
Wednesday, 27 April 2011 [Samuel A. Rebelsky]
Thursday, 28 April 2011 [Samuel A. Rebelsky]
do both deletion strategiesproblem.
http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2011S/Labs/lists-lab.html.
[Skip to Body]
Primary:
[Front Door]
[Schedule]
[Piazzza]
-
[Academic Honesty]
[Instructions]
Current:
[Current Outline]
[Current EBoard]
-
[Current Assignment]
[Current Lab]
[Current Reading]
Groupings:
[Assignments]
[Documents]
[EBoards]
[Examples]
[Exams]
[Handouts]
[Labs]
[Outlines]
[Readings]
[Reference]
Related Courses:
[CSC195 2003S (Rebelsky)]
[CSC161 2009F (Coahran)]
[CSC161 2010S (Walker)]
[CSC161 2010F (Rebelsky)]
Misc:
[SamR]
[ISO]
[GNU Coding Standards]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Thu Apr 28 23:17:16 2011.
The source to the document was last modified on Thu Apr 28 23:17:10 2011.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2011S/Labs/lists-lab.html.
A PDF version of this document may be found at
http://www.cs.grinnell.edu/~rebelsky/Courses/CSC161/2011S/Labs/lists-lab