Skip to content

Instantly share code, notes, and snippets.

View gist:9046522
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
View explorememory.c
//
// main.c
// memory
//
// Created by Richard Buckland on 20/11/12.
//
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
View explorememory.c
//
// main.c
// memory
//
// Created by Richard Buckland on 20/11/12.
//
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
View gist:a23bf65909b31ba3065a
// 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;
}
View gist:322aa32df456a22783b1
-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 Sep 3, 2014
Sort investigation
View results
# 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
View gist:b25244eb5a59cb1c0315
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
View sort 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
View gist:11457308e4ea5ce37e4c
#!/usr/bin/perl -w
$start = 10;
$end = 100000;
$alg = "./sortA";
$tmp = "tmp1";
@types = ("R", "A", "D");
$start = 10;
print "Testing: $alg ";
View gist:d62fbd15cdd3c3d87306
# Sort B
Input:
```
wagner % cat stableCheck
5 one
7 two
1 three
3 four
9 five