Search found 1 match
- Wed Jun 15, 2022 9:40 am
- Forum: Programs, Libraries and Tools
- Topic: Restore the original array after Bubble Sort
- Replies: 3
- Views: 4308
Restore the original array after Bubble Sort
If the given array is [5, 8, 1, 9], after bubble sort, the sorted array will be [1, 5, 8, 9]. Is there a way to restore the original array [5, 8, 1, 9] using the sorted [1, 5, 8, 9]? Do we have any algorithm for this? I have tried this #include <iostream> #include <algorithm> int main() { int test[]...