Skip to main content

Definitions by raccoon519

Bubble Hash 

To sort a hashtable or an associative array, by using the bubblesort algorithm. Not a widely known expression, it's more like an inside joke by programmers commonly using (or at least well familiar with) some sort of cannabis.

Bubblesort is a sorting algorithm which iterates over a table of data, taking two pairs of valus each time and switches them so that the smaller one of them is moved to the top. If visualized, it's almost as if the small numbers moves with a "bubbling" effect towards the top of the list.
// Bubble Hash demo
void swap(int *a,int *b)
{
int tmp=*a;
*a=*b;
*b=tmp;
};

void bubbleSort(int *array,int size)
{
for(int i=size-1;i>0;--i)
{
for(int pos=0;pos<i;++pos)
{
if(arraypos>arraypos+1)
swap(&arraypos,&arraypos+1);
};
};
};

bubbleSort(lebanese_blonde,420);
Bubble Hash by raccoon519 April 16, 2006