![]() |
VOOZH | about |
The list::pop_back() is a built-in function in C++ STL which is used to remove an element from the back of a list container. That is, this function deletes the last element of a list container. This function thus decreases the size of the container by 1 as it deletes an element from the end of the list.
list_name.pop_back();
The below program illustrates the list::pop_back() function in C++ STL.
Initial List: 10 20 30 40 List after removing an element from end: 10 20 30
Time Complexity: O(1)
Auxiliary Space: O(1)