sorting fixes for MSVC and CPPLINT

(cherry picked from commit 76a5f572d5)
This commit is contained in:
Krishna Vedala
2020-05-26 11:46:24 -04:00
parent e4084e77a8
commit 887bff8a9e
3 changed files with 43 additions and 60 deletions

View File

@@ -12,8 +12,8 @@ void beadSort(int *a, int len) {
if (a[i] > max) max = a[i];
// allocating memory
unsigned char beads[max * len];
memset(beads, 0, sizeof(beads));
unsigned char *beads = new unsigned char[max * len];
memset(beads, 0, max * len);
// mark the beads
for (int i = 0; i < len; i++)
@@ -39,6 +39,7 @@ void beadSort(int *a, int len) {
a[i] = j;
}
delete[] beads;
}
// driver function to test the algorithm