AddAtBeg adds a new snode with given value at the beginning of the list.
(val T)
| 22 | |
| 23 | // AddAtBeg adds a new snode with given value at the beginning of the list. |
| 24 | func (ll *Singly[T]) AddAtBeg(val T) { |
| 25 | n := NewNode(val) |
| 26 | n.Next = ll.Head |
| 27 | ll.Head = n |
| 28 | ll.length++ |
| 29 | } |
| 30 | |
| 31 | // AddAtEnd adds a new snode with given value at the end of the list. |
| 32 | func (ll *Singly[T]) AddAtEnd(val T) { |