Update algorithms.py
Pass the dtype to `_from_sequence` in `_reconstruct_data` in order to support ExtensionArrays with ExtensionDtypes that have parameters.

- [ ] closes #31252 
- [ ] tests added / passed
- [ ] passes `black pandas`
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

seems fine, needs tests Slight error on my part- I hadn't realized that the `values` parameter in `_reconstruct_data` is not actually an ndarray, as the docstring notes.  In this case it is the ExtensionArray type. My code was checking for an empty array before checking to see if it was the same type as the class.  I can simply return the empty `values` GenotypeArray.

That said, I think this change couldn't hurt- it's just passing an optional parameter that already exists.  

I discovered this while utilizing the built-in tests.  It looks like the `base.BaseMethodsTests` covers this already.  @jrm5100 if this doesn't change anything then (test or user xp), then I don't think we need to change. do you have a failing example that this patches? For now it looks like this function (`_reconstruct_data`) is called in a few algorithms, but `factorize` seems to be the only relevant one (where an `ExtensionArray` is passed to this function explicitly.

- `unique`, where `ExtensionArray` are dispatched to their own method
- `factorize`, where I ran into this issue.
- `_value_counts_arraylike`, which doesn't handle `ExtensionArray` differently
- `mode`, which has a special case for `Categorical` but not `ExtensionArray`

For `factorize`, the `dtype` is specifically saved to a variable and passed to the function:

```python
    if is_extension_array_dtype(values):
        values = extract_array(values)
        codes, uniques = values.factorize(na_sentinel=na_sentinel)
        dtype = original.dtype
#... 
uniques = _reconstruct_data(uniques, dtype, original)
```

`_reconstruct_data` calls the `_from_sequence` of the dtype's associated `ExtensionArray` which optionally takes this parameter:

```python
@classmethod
def _from_sequence(cls, scalars, dtype=None, copy=False):
```

I'll admit that I don't have an example explicitly requiring this change.  I do think passing an optional parameter instead of ignoring it (when it is readily available) makes sense.  I also think this is probably something that could come up again in the future if this function is used with `ExtensionArray` elsewhere.

I understand if you view it as unnecessary.  I do think the minor docstring fix should be made- would have saved me and possibly others a bit of time when implementing an ExtensionArray. > I'll admit that I don't have an example explicitly requiring this change. I do think passing an optional parameter instead of ignoring it (when it is readily available) makes sense.

You're right that this makes sense, but as a practical matter, no one is going to merge this if it doesn't have tests. closing, if you can find a case that hits this we can reopen