Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void insertAfterIndex(int index, int value)
- {
- ElementListy* e = head; //znalezienie wsk elementu za ktorym mam byc wstawiona wartosc
- for (int i = 0; i < index; i++) {
- e = e->next;
- } //element za ktorym wstawiamy to
- ElementListy* p;
- if (e == tail) pushBack(value); //uwstawienie za ogonem jesli to koniec listy
- else
- { //wstawienie w srodku listy
- p = new ElementListy;
- p->value = value;
- p->next = e->next;
- p->previous = e;
- size++;
- e->next->previous = p;
- e->next = p;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement