This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* 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()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |