sorting fixes for MSVC and CPPLINT

This commit is contained in:
Krishna Vedala
2020-05-26 11:46:24 -04:00
parent bfeffe532a
commit 76a5f572d5
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