Restores the original order of elements from the reordered list. Parameters: - newarr (List): The reordered array. Returns: List: The array with elements restored to their original order.
(self, newarr: List)
| 419 | yield from [x[1] for x in arr] |
| 420 | |
| 421 | def get_original(self, newarr: List) -> List: |
| 422 | """ |
| 423 | Restores the original order of elements from the reordered list. |
| 424 | |
| 425 | Parameters: |
| 426 | - newarr (List): The reordered array. |
| 427 | |
| 428 | Returns: |
| 429 | List: The array with elements restored to their original order. |
| 430 | """ |
| 431 | res = [None] * self.size |
| 432 | cov = [False] * self.size |
| 433 | |
| 434 | for ind, v in zip(self.reorder_indices, newarr): |
| 435 | res[ind] = v |
| 436 | cov[ind] = True |
| 437 | |
| 438 | assert all(cov) |
| 439 | |
| 440 | return res |
| 441 | |
| 442 | def __len__(self): |
| 443 | return self.size |
no outgoing calls
no test coverage detected