This file contains 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 | |
#Ensure we have the quantity specified on the CLI | |
if [ -z "$3" ]; then ARG_ERR=ERR; fi | |
if [ -z "$2" ]; then ARG_ERR=ERR; fi | |
if [ -z "$1" ]; then ARG_ERR=ERR; fi | |
if [ -n "$ARG_ERR" ]; | |
then | |
echo "Usage: <filecount> <filenamebase> <filenameextension>" | |
exit |
This file contains 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
h(k) = ( (p0 * k + p1) % p2) % T | |
h(k) = ((438439 * k + 34723753) % 376307) % 10 |
This file contains 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
git log --author="Jared Barboza" --pretty=tformat: --numstat | \ | |
grep -v public/javascripts/jquery | \ | |
gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END \ | |
{ printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }' - |
This file contains 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
git log --author="Hans-Helge Bürger" --pretty=tformat: --numstat | \ | |
gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END \ | |
{ printf "added lines: %s removed lines: %s total lines: %s\n",add,subs,loc }' - |
This file contains 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
#include "heap.h" | |
#include <stdlib.h> | |
struct Heap { | |
int capacity; | |
int size; | |
int *heap; | |
int type; | |
}; |
This file contains 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
int countchar (char list[]) | |
{ | |
int i, count = 0; | |
for (i = 0; list[i] != '\0'; i++) | |
count++; | |
return (count); | |
} |
This file contains 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
void quickSort(int a[ ], int from, int to) | |
{ // sort partition from ... to of array a | |
int i, pivot, new_val; | |
if (from < to) // at least 2 elements in partition | |
{ | |
pivot = from; | |
for (i = from + 1; i <= to; i++) | |
{ | |
new_val = a[i]; |
This file contains 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
void mergeSort(int a[ ], int n) | |
{ | |
int endcstr, endbstr, check, finished = 0; // booleans | |
int i, j, k, maxc, maxb; | |
int *b, *c; // pointers for arrays | |
b = (int *) malloc( n * sizeof(int) ); | |
c = (int *) malloc( n * sizeof(int) ); | |
while ( !finished ) | |
{ // distribution pass | |
i = j = k = 0; |
This file contains 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
void shuttlesort (int a[ ], int n) | |
{ | |
int temp, i, j; | |
for (i = 0; i < n – 1; i++) // primary pass | |
{ | |
if (a[i] > a[i + 1]) | |
{ | |
j = i – 1; | |
temp = a[i + 1]; // small value to move back |
This file contains 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
void bubbleSortV2(int a[ ], int n) // flagged bubble sort | |
{ | |
int i, temp, comps, sorted = 0; // sorted is initially false | |
comps = n – 1; | |
while ( !sorted ) // comps reduces on each pass | |
{ | |
sorted = 1; // set true for each pass | |
for (i = 0; i < comps; i++) | |
{ |