Reorders the elements in the array based on the sorting function. Parameters: - arr (Union[List, Tuple[Tuple[int, Any], ...]]): The array or iterable to be reordered. Yields: List: Yields reordered elements one by one.
(self, arr: Union[List, Tuple[Tuple[int, Any], ...]])
| 405 | yield from batch |
| 406 | |
| 407 | def _reorder(self, arr: Union[List, Tuple[Tuple[int, Any], ...]]) -> List: |
| 408 | """ |
| 409 | Reorders the elements in the array based on the sorting function. |
| 410 | |
| 411 | Parameters: |
| 412 | - arr (Union[List, Tuple[Tuple[int, Any], ...]]): The array or iterable to be reordered. |
| 413 | |
| 414 | Yields: |
| 415 | List: Yields reordered elements one by one. |
| 416 | """ |
| 417 | arr = sorted(arr, key=lambda x: self.fn(x[1])) |
| 418 | self.reorder_indices.extend([x[0] for x in arr]) |
| 419 | yield from [x[1] for x in arr] |
| 420 | |
| 421 | def get_original(self, newarr: List) -> List: |
| 422 | """ |