285
правок
Изменения
Стек
,→На списке
push(element)
OldHead = new ListItem
NewHead = new ListItem
OldHead = head
NewHead.data = element
NewHead.next = OldHead
head = NewHead
delete NewHead
delete OldHead
pop()
OldHead = new ListItem OldHead = head int element = headOldHead.data head = headOldHead.next delete OldHead
return element