+ 1
Linked list Односвязный список
Добрый день.Помогите написать метод для вставки нового элемента ,слева от текущего,т.е последнего. Hello. Help me write a method to add a new item to the left of the current. https://code.sololearn.com/c9XbNj4zp1AL/?ref=app
1 Answer
0
Well done so far.
Add a item to the left it more difficult.
Because you need to renumber all elements that live on the right of this new element.
Start by making a
public OwnListElem Previous;
And assign the correct value
May be make a routine to print the list in reverse.
Where should the element be add
at the start, creating a new head
in the middle using a index