_Ziens_

Ревёрс вдусвязного списка на С++

May 4th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.17 KB | None | 0 0
  1. void reverse(List *list) {
  2.     for (ListItem *item = list->head; item; item = item->prev)
  3.         std::swap(item->prev, item->next);
  4.     std::swap(list->tail, list->head);
  5. }
Add Comment
Please, Sign In to add comment