Skip to content

Commit

Permalink
bs4b, fix for U 2e7
Browse files Browse the repository at this point in the history
  • Loading branch information
pvto committed Sep 6, 2015
1 parent 2d45a2f commit 4490bdf
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
7 changes: 7 additions & 0 deletions bleedsort-4-times.txt
Expand Up @@ -401,7 +401,14 @@ bleedsort3 1.6915499999999999 bleedsort4 1.4265 Arrays.sort 4.41045 [ bin 100000
bleedsort3 1.8112000000000001 bleedsort4 1.4443499999999998 Arrays.sort 4.28305 [ bin 100000 simil. 0.2 compr. 1.0 mix. 0.1 p 0.5 exp 100.0 n 250000 ]: 0.4228762213842939 0.3372246413186864
bleedsort3 2.0625 bleedsort4 1.58625 Arrays.sort 4.4077 [ bin 100000 simil. 0.2 compr. 1.0 mix. 0.1 p 0.5 exp 100.0 n 300000 ]: 0.4679311205390566 0.3598815708873108
bleedsort3 0.1161 bleedsort4 0.18295 Arrays.sort 0.07695 [ rnd 2000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 1.5087719298245612 2.377517868745939
bleedsort3 0.4925 bleedsort4 0.6445000000000001 Arrays.sort 0.525 [ rnd 10000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.9380952380952381 1.2276190476190476
bleedsort3 1.1232 bleedsort4 1.0706 Arrays.sort 1.1436 [ rnd 20000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.9821615949632739 0.9361664917803428
bleedsort3 11.117 bleedsort4 11.231 Arrays.sort 13.948 [ rnd 200000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.7970318325207916 0.805205047318612
bleedsort3 37.730000000000004 bleedsort4 36.36 Arrays.sort 48.175 [ rnd 600000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.783186299948106 0.7547483134405812
bleedsort3 128.975 bleedsort4 127.6 Arrays.sort 172.9 [ rnd 2000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.7459514170040485 0.737998843262001
bleedsort3 258.25 bleedsort4 260.15 Arrays.sort 368.3 [ rnd 4000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.7011946782514255 0.7063535161553081
bleedsort3 397.6 bleedsort4 328.55 Arrays.sort 543.2 [ rnd 6000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.7319587628865979 0.604841678939617
bleedsort3 514.9 bleedsort4 437.8 Arrays.sort 740.45 [ rnd 8000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.6953879397663583 0.5912620703626174
bleedsort3 663.05 bleedsort4 566.85 Arrays.sort 933.95 [ rnd 10000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.7099416456983778 0.6069382729268162
bleedsort3 1311.05 bleedsort4 1232.6 Arrays.sort 1958.8 [ rnd 20000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.6693128445987339 0.6292628139677353
bleedsort3 8027.35 bleedsort4 8114.8 Arrays.sort 3966.6 [ rnd 40000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 2.023735693036858 2.0457822820551606
20 changes: 20 additions & 0 deletions graphs/plot.R
Expand Up @@ -204,6 +204,26 @@ title(main=lbl, xlab=xlab, ylab=ylab)



cols = c(rgb(0,0,1,1), rgb(1,0,0,1), rgb(0,1,0,1))

t = read.table("rnd-u.csv", header=FALSE)
x = t$V9
xlab = "x = array size"
ylab = "y = ms"
lbl = "~U(0, x)"

ymax = max(max(t$V2),max(t$V4),max(t$V6))
ymin = 0 #min(min(t$V2),min(t$V4),min(t$V6))
plot(x, t$V4, col=cols[1], ylim=c(ymin,ymax), type="l", xlab="", ylab="")
points(x, t$V4, col=cols[1])
lines(x, t$V2, col=cols[2]); points(x, t$V2, col=cols[2])
lines(x, t$V6, col=cols[3]); points(x, t$V6, col=cols[3])
legend(min(x), ymax, c("bleedsort4", "bleedsort3", "Arrays.sort"), col=cols, lty=c(1,1))
title(main=lbl, xlab=xlab, ylab=ylab)
grid (NULL,NULL, lty = 6, col = "cornsilk2")



t = read.table("skew-07-5e5.csv", header=FALSE)
x = t$V19
xlab = "x = skew iterations"
Expand Down
12 changes: 12 additions & 0 deletions graphs/rnd-u.csv
@@ -0,0 +1,12 @@
bleedsort3 0.1161 bleedsort4 0.18295 Arrays.sort 0.07695 [ rnd 2000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 1.5087719298245612 2.377517868745939
bleedsort3 0.4925 bleedsort4 0.6445000000000001 Arrays.sort 0.525 [ rnd 10000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.9380952380952381 1.2276190476190476
bleedsort3 1.1232 bleedsort4 1.0706 Arrays.sort 1.1436 [ rnd 20000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.9821615949632739 0.9361664917803428
bleedsort3 11.117 bleedsort4 11.231 Arrays.sort 13.948 [ rnd 200000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.7970318325207916 0.805205047318612
bleedsort3 37.730000000000004 bleedsort4 36.36 Arrays.sort 48.175 [ rnd 600000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.783186299948106 0.7547483134405812
bleedsort3 128.975 bleedsort4 127.6 Arrays.sort 172.9 [ rnd 2000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.7459514170040485 0.737998843262001
bleedsort3 258.25 bleedsort4 260.15 Arrays.sort 368.3 [ rnd 4000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.7011946782514255 0.7063535161553081
bleedsort3 397.6 bleedsort4 328.55 Arrays.sort 543.2 [ rnd 6000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.7319587628865979 0.604841678939617
bleedsort3 514.9 bleedsort4 437.8 Arrays.sort 740.45 [ rnd 8000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.6953879397663583 0.5912620703626174
bleedsort3 663.05 bleedsort4 566.85 Arrays.sort 933.95 [ rnd 10000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.7099416456983778 0.6069382729268162
bleedsort3 1311.05 bleedsort4 1232.6 Arrays.sort 1958.8 [ rnd 20000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 0.6693128445987339 0.6292628139677353
bleedsort3 8027.35 bleedsort4 8114.8 Arrays.sort 3966.6 [ rnd 40000000 simil. 0.0 compr. 1.0 mix. 0.1 p -1.001 exp 1.0 n 300000 ]: 2.023735693036858 2.0457822820551606
Binary file added img/rnd-u.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/main/java/util/sort/BleedSort4b.java
Expand Up @@ -16,12 +16,13 @@ public class BleedSort4b {
VERY_REPETITIVE = 256,
REPETITIVE = 512,
SMALL_RANGE = 1024,
LONG_UNCHANGING_RUNS_IN_DATA = 2048;
LONG_UNCHANGING_RUNS_IN_DATA = 2048,
SMALL_TARGET = 4096;

public static void bleedSort(int[] a)
{
double[] sampledRepetition = sampleRepetition(a, 20);
if (sampledRepetition[0] > 20)
if (sampledRepetition[0] > Math.max(20, a.length / 1000000))
{
if (sampledRepetition[1] > 6)
{
Expand Down

0 comments on commit 4490bdf

Please sign in to comment.