Skip to content

Instantly share code, notes, and snippets.

View arschles's full-sized avatar
🎯
Focusing

Aaron Schlesinger arschles

🎯
Focusing
View GitHub Profile
@gsdayton98
gsdayton98 / deleteDuplicates.cpp
Last active August 29, 2015 14:26
C++ code to delete duplicates from an array using a heap structure to achieve O(n*log n) performance
#include <cstdlib>
#include <algorithm>
// Delete duplicate entries from an array using C++ heap.
int *deleteDuplicates(int theArray[], size_t theArrayLength)
{
int *topSortedArray = theArray + theArrayLength;
if (theArrayLength > 1)
{
// Heap is in theArray[0:heapEnd-1]