Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@arunib
arunib / bubble_sort - Copy.c
Last active July 19, 2022 17:12
simplest bubble sort
/*
Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted.
*/
void swap(int *a, int *b)
{
*a = *a + *b;
*b = *a - *b;
*a = *a - *b;
}
void bubble_sort(int* a, int len) {
@arunib
arunib / compare.cpp
Last active July 20, 2022 04:15
comparator
/* compare playesr first by score and then sort alphabetically*/
static int comparator(Player a, Player b) {
// descending order of score
if(a.score>b.score)
return 1;
else if(a.score<b.score)
return -1;
else {
// ascending order - alpahebtical
int out = strcmp(b.name.c_str(),a.name.c_str());