Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Aaron Schlesinger arschles

🏠
Working from home
View GitHub Profile
@gsdayton98
gsdayton98 / deleteDuplicates.cpp
Last active Aug 29, 2015
C++ code to delete duplicates from an array using a heap structure to achieve O(n*log n) performance
View deleteDuplicates.cpp
#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]
You can’t perform that action at this time.