distructor of the node of the link list

// Destructor for a linked list node
template <typename T>
Node<T>::~Node() {
    // The destructor is responsible for cleaning up resources allocated by the node
    // In the case of a linked list node, it typically involves releasing memory occupied by the data and next pointer

    // Step 1: Delete the data (if applicable)
    delete data;

    // Step 2: Set the next pointer to null
    next = nullptr;

    // Note: If the data is a primitive type (int, char, float, etc.), there may not be a need to delete it explicitly
    // In that case, you can skip Step 1.
}