src/
subfolder.
AssassinNode
into a linked list?
String
objects you are passed is just a way of giving you the names in a specific order. You need to access those names (not the nodes) and convert them into a chain of AssassinNode
objects that represent the state of the game (who is stalking whom). The structures you make will look like "lists-that-are-linked", that is, they are lists comprised of nodes (AssassinNode
) that are connected via next
links, but they are not LinkedList
objects (the Java collection). The assignment write-up states : "You may not construct any arrays, ArrayLists
, stacks, queues, sets, maps, or other data structures to solve this problem."
AssassinNode
work?
AssassinNode
is just a structure that keeps track of two pieces of data (name
and killer
) and a link to another node. As all of its fields are public, you have access to them as you are writing your AssassinManager
code and should modify them as is necessary to implement the behavior specified by the write-up
AssassinNode
objects can I use? It doesn't seem like I have enough variables to manipulate the lists.
new AssassinNode
once for each name you are given. It does not mean that you cannot create temporary variables to point to these nodes (such as you do with current
when traversing a list). You may use as many temporary variables as is required to manipulate the lists.