f853d72c7518cf7246fabe3f67ae74fec55c0fab
haas/fall2026/data/projects/dll0.md
| ... | ... | @@ -0,0 +1,35 @@ |
| 1 | +# PROJECT: DOUBLY LINKED LISTS (dll0) |
|
| 2 | + |
|
| 3 | +## OBJECTIVE |
|
| 4 | + |
|
| 5 | +Evolving our singly-linked list implementation to a doubly-linked list. |
|
| 6 | + |
|
| 7 | +## TASK |
|
| 8 | + |
|
| 9 | +By the deadline, please do the following: |
|
| 10 | + |
|
| 11 | + * add a `prev` Node pointer to your `Node` struct |
|
| 12 | + * update the logic in `insert()`, `append()`, and `obtain()` for |
|
| 13 | + use with the `prev` pointer (should simplify some things, lessen |
|
| 14 | + the need for as many temporary variables) |
|
| 15 | + * as appropriate, update other linked list functions if the prev |
|
| 16 | + has any transactions there (`mknode()`, for instance) |
|
| 17 | + |
|
| 18 | +## SUBMISSION |
|
| 19 | + |
|
| 20 | +``` |
|
| 21 | +130:dll0:final tally of results (130/130) |
|
| 22 | +*:dll0:update node struct [13/13] |
|
| 23 | +*:dll0:update and test mknode function [13/13] |
|
| 24 | +*:dll0:update and test rmnode function [13/13] |
|
| 25 | +*:dll0:adapt and test insert function [26/26] |
|
| 26 | +*:dll0:adapt and test append function [26/26] |
|
| 27 | +*:dll0:adapt and test obtain function [26/26] |
|
| 28 | +*:dll0:code is well commented, organized, functional [26/26] |
|
| 29 | +``` |
|
| 30 | + |
|
| 31 | +Additionally: |
|
| 32 | + * Solutions not abiding by spirit of project will be subject to a 25% overall deduction |
|
| 33 | + * Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction |
|
| 34 | + * Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction |
|
| 35 | + * Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction |
haas/fall2026/data/projects/dls0.md
| ... | ... | @@ -0,0 +1,75 @@ |
| 1 | +# PROJECT: DOUBLY LINKED STACKS (dls0) |
|
| 2 | + |
|
| 3 | +## OBJECTIVE |
|
| 4 | + |
|
| 5 | +Building on top of your doubly-linked list implementation, implement |
|
| 6 | +a stack. |
|
| 7 | + |
|
| 8 | +## TASK |
|
| 9 | + |
|
| 10 | +By the deadline, please do the following: |
|
| 11 | + |
|
| 12 | + * create a `Stack` management struct, containing a `size` element, |
|
| 13 | + and a `top` `Node` pointer |
|
| 14 | + * `size`, if 0, will indicate an unbounded stack (positive means bounded) |
|
| 15 | + * `top` points to the node at the top of the stack (on the list) |
|
| 16 | + * implement an `mkstack()` function |
|
| 17 | + * implement an `rmstack()` function |
|
| 18 | + * implement a `push()` function |
|
| 19 | + * implement a `pop()` function |
|
| 20 | + * implement a `peek()` function |
|
| 21 | + * implement an `isempty()` function |
|
| 22 | + |
|
| 23 | +## BACKGROUND |
|
| 24 | + |
|
| 25 | +A stack is a LIFO (Last-In, First-Out) data structure, which we |
|
| 26 | +will simplify by building on top of our existing doubly-linked list |
|
| 27 | +infrastructure. |
|
| 28 | + |
|
| 29 | +The last item placed on the top of the stack will be the first item |
|
| 30 | +retrieved from the stack. |
|
| 31 | + |
|
| 32 | +The strength of the stack comes from the particular restrictions we place |
|
| 33 | +on its access: we can only access the top of the stack. This will be |
|
| 34 | +either the start or end of your underlying list (your implementation, you |
|
| 35 | +pick which and run with it). |
|
| 36 | + |
|
| 37 | +The stack `push()` function will take the node and place it on the top of |
|
| 38 | +the stack (by calling the appropriate underlying list function) |
|
| 39 | + |
|
| 40 | +The stack `pop()` function will retrieve the node at the top of the stack |
|
| 41 | +(in the process adjusting `top` to point to the new node at the top of |
|
| 42 | +the stack) |
|
| 43 | + |
|
| 44 | +You will want to call upon the underlying list functionality to do the |
|
| 45 | +heavy-lifting. |
|
| 46 | + |
|
| 47 | +For the stack, **PUSH** and **POP** are the two central actions. Without |
|
| 48 | +them there is no stack. |
|
| 49 | + |
|
| 50 | +Often, you will find stacks also implement other helper functions, such |
|
| 51 | +as an `isempty()` function which returns a boolean value regarding the |
|
| 52 | +stack status- true for an empty stack, false for a populated one. |
|
| 53 | + |
|
| 54 | +Then there's `peek()`, which is like a non-destructive `pop()`: it |
|
| 55 | +retrieves a **copy** of the node at the top of the stack, making no |
|
| 56 | +actual changes to the stack itself. |
|
| 57 | + |
|
| 58 | +## SUBMISSION |
|
| 59 | + |
|
| 60 | +``` |
|
| 61 | +156:dls0:final tally of results (156/156) |
|
| 62 | +*:dls0:create stack struct [13/13] |
|
| 63 | +*:dls0:create and test mkstack function [26/26] |
|
| 64 | +*:dls0:create and test rmstack function [13/13] |
|
| 65 | +*:dls0:create and test push function [26/26] |
|
| 66 | +*:dls0:adapt and test pop function [26/26] |
|
| 67 | +*:dls0:adapt and test isempty function [26/26] |
|
| 68 | +*:dls0:adapt and test peek function [26/26] |
|
| 69 | +``` |
|
| 70 | + |
|
| 71 | +Additionally: |
|
| 72 | + * Solutions not abiding by spirit of project will be subject to a 25% overall deduction |
|
| 73 | + * Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction |
|
| 74 | + * Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction |
|
| 75 | + * Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction |