Linked Lists
A linked list is a data structure that is similar to an array in that both can be used for data that is a sequential list of elements.
A linked list is a collection of elements, or nodes. Each node contains a pointer to the next node and thus the nodes need not be adjacent in memory.
Adding a Node
Empty List
; initiateLD R2, NEW_ITEMLD R1, LISTHEAD; insertSTR R2, R0, #0STR R1, R2, #0
Not Empty List
; R2 is the node to insert; R1 is the current pointer, R0 is the previous pointer; initiateLD R2, NEW_ITEMLD R1, LISTHEAD; compare, to sort by NAMEsLOOP ...BRp INSERTBRn MOVE_PTRBRz LOOP; move pointerMOVE_PTR ADD R0, R1, #0LDR R1, R1, #0; insertINSERT STR R2, R0, #0STR R1, R2, #0

