@@ -47,15 +47,14 @@ LinkedLists support these methods for manipulation:
4747
4848### Node Methods
4949- ` addNode(name, value?) ` - Add new node with optional value
50- - ` insertNode(index, name) ` - Insert node at specific position
50+ - ` insertNode(index | id , name, value? ) ` - Insert node at specific position or after node ID with optional value
5151- ` removeNode(name) ` - Remove specific node
5252- ` setValue(index | id, value) ` - Set value for node at index or node id
5353- ` setColor(index | id, color) ` - Set color for node at index or node id
5454- ` setArrow(index | id, arrow) ` - Set arrow for node at index or node id
5555
5656### Value Methods
5757- ` addValue(value) ` - Add value to end of list
58- - ` insertValue(index | id, value) ` - Insert value at specific position or node id
5958- ` removeValue(value) ` - Remove first occurrence of value
6059- ` removeAt(index) ` - Remove node at specific position
6160
@@ -124,11 +123,15 @@ list.setColor(2, "green")
124123list.setArrow(2, "new")
125124
126125page
127- list.insertNode(1, n1_5)
128- list.setValues([ 10, 15, 20, 30] )
126+ list.insertNode(1, n1_5, 15) // insert by index
129127list.setColors([ null, "blue", null, "green"] )
130128list.setArrows([ null, "inserted", null, null] )
131129
130+ page
131+ list.insertNode(n1_5, n1_75, 17.5) // insert after node ID
132+ list.setColors([ null, "blue", "yellow", null, "green"] )
133+ list.setArrows([ null, "inserted", "after n1_5", null, null] )
134+
132135page
133136list.removeNode(n2)
134137list.setValues([ 10, 15, 30] )
195198show sorted
196199
197200page
198- sorted.insertNode(1, n25)
199- sorted.setValues([ 10, 25, 30, 50] )
201+ sorted.insertNode(n10, n25, 25) // insert after n10 node
200202sorted.setColor(1, "red")
201203sorted.setArrow(1, "inserted")
202204`}
0 commit comments