Insert Node

Create a function inserts an element at a given position. Position 0 represents the front of the list, 1 represents the following position, etc. There is no need to bound check; assume the user will always insert a valid position.

Use the following incomplete function definition.

void insert(Node* &head, int element, int position ) { 
    // . . .
}


Improve this page