Function to partition a linked list at the nth element
'discard' method to delete node with specified predecessor in a linked list