Skip to content

Instantly share code, notes, and snippets.

View matthewpalmer's full-sized avatar

Matthew Palmer matthewpalmer

View GitHub Profile
@matthewpalmer
matthewpalmer / gist:9046522
Created February 17, 2014 07:57
socket hang up
info: Welcome to Nodejitsu _matthewpalmer
info: jitsu v0.13.9, node v0.10.21
info: It worked if it ends with Nodejitsu ok
info: Executing command deploy
info: Analyzing application dependencies in node app.js
info: Checking app availability wildfire
info: Creating app wildfire
error: Error creating wildfire
error: socket hang up
error: Error running command deploy
//
// main.c
// memory
//
// Created by Richard Buckland on 20/11/12.
//
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
//
// main.c
// memory
//
// Created by Richard Buckland on 20/11/12.
//
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
// Get the index in the array of the header
static int indexOfHeader(free_header_t *header) {
int index = (int) ((void *)header - (void *)memory);
return index;
}
-f
Deallocating memory at 0x7fe751801e10
Our index is 3072
Start header is 0
0x7fe751801200 index: 0 size: 2048 next: 2048 prev: 4032 magic: deadbeef
Entering the loop
Finished the loop
The first header after 0x7fe751801e00 index: 3072 size: 256 next: 3840 prev: 3968 magic: deadbeef
is 0x7fe751801200 index: 0 size: 2048 next: 2048 prev: 4032 magic: deadbeef
@matthewpalmer
matthewpalmer / results
Created September 3, 2014 08:47
Sort investigation
# Sort A
```
Testing: ./sortA
Input size: 10
R: 0.00 seconds
A: 0.00 seconds
D: 0.00 seconds
Input size: 20
R: 0.00 seconds
#!/usr/bin/perl -w
$start = 10;
$end = 100000;
$alg = "./sortA";
$tmp = "tmp1";
@types = ("R", "A", "D");
$start = 10;
print "Testing: $alg ";
Graph
http://i.imgur.com/uxBzv0a.png
# Sort A
We ran our standard tests of input data from 1000 to 100,000 in size, with intervals of 1000. This resulted in the above graph.
The average (random) case is roughly polynomial, and it performs nearly as badly on descending data. Interestingly, the algorithm performs very well on ascending data. With these observations, we can narrow the algorithm down to one of the following:
- oblivious bubble sort
- Vanilla Insertion sort
- Insertion sort with binary search
@matthewpalmer
matthewpalmer / sort research
Last active August 29, 2015 14:06
research
# Oblivious Bubble sort
- average case: quadratic
- unstable
- best case performance on sorted data O(N)
- worst case performance on reverse sorted data O(N^2)
# Vanilla Insertion sort
- average case: quadratic
- O(N) best case for sorted data
- worst case reverse order
# Sort B
Input:
```
wagner % cat stableCheck
5 one
7 two
1 three
3 four
9 five