We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Insertion Sort Advanced Analysis
Insertion Sort Advanced Analysis
Sort by
recency
|
369 Discussions
|
Please Login in order to post a comment
Note: Turn the "result" in main into a long long (c++).
For those doing it in c++, I threw long long at everything I found. Including, the main, where lo and behold, the "result" is an int! So ofcs it was not giving the right result for extra long arrays!!!!!!
Here's my solution, modified Fenwick tree:
there's a broken test case for Golang, 1. the moves use int32, some test case overflow 2. for several testcase are broken, it expected to have 15 test set but it only have 15, causes error parsing.
import java.util.*;
public class InsertionSortShiftCounter {
}
Pretty easy with modified merge sort.
include
using namespace std;
string ltrim(const string &); string rtrim(const string &); vector split(const string &);
class FenwickTree { public: FenwickTree(long size) : tree(size + 1, 0) {}
private: vector tree; };
long insertionSort(vector arr) { long shifts = 0; long maxElement = *max_element(arr.begin(), arr.end()); FenwickTree fenwickTree(maxElement);
}
int main() { ofstream fout(getenv("OUTPUT_PATH"));
}
string ltrim(const string &str) { string s(str);
}
string rtrim(const string &str) { string s(str);
}
vector split(const string &str) { vector tokens;
}