bst = require('./bst');
rbt = require('./rbt');
sched = require('./scheduler');

function generate_tasks (n, duration) {
    var queue = [];
    for (var i=0; i<n; i++) {
        var task = {id: "t" + i,
                    start_time: 1,
                    duration: duration};
        queue.push(task);
    }
    return {num_of_tasks: n,
            total_time: n*duration+1,
            task_queue: queue};
}

function run_tasks (pow1, pow2, timeline) {
    for (var i=pow1; i<=pow2; i++) {
        var num_tasks = Math.pow(2,i);
        var tasks = generate_tasks(num_tasks, 10);

        // Run the CFS algorithm and generate a results report
        var results = sched.runCFS(tasks, timeline);

        sched.generate_report(tasks, results);
        console.log("\n");
    }
}

var bst_timeline = new bst.BST(function (a, b) {
        return a.val.vruntime - b.val.vruntime; });
var rbt_timeline = new rbt.RBT(function (a, b) {
        return a.val.vruntime - b.val.vruntime; });

console.log("Running with BST:");
run_tasks(10, 10, bst_timeline);
console.log("Running with RBT:");
run_tasks(10, 10, rbt_timeline);

@@ -41,16 +41,86 @@
 /rbt');%0A
+heaptree = require('./heaptree');%0Aheaparray = require('./heaparray');%0A
 sched = 
@@ -853,39 +853,189 @@
 %0A%7D%0A%0A
-var bst_timeline = new bst.BST(
+function usage() %7B%0A    console.log(%22node run_tasks.js %5Bbst%7Crbt%7Cheaptree%7Cheaparray%5D START_FACTOR END_FACTOR%22);%0A    process.exit(2);%0A%7D%0A%0Aif (process.argv.length %3C 5) %7B%0A    usage();%0A%7D%0A%0A
 func
@@ -1035,37 +1035,37 @@
 %7D%0A%0Afunction 
+vsort
 (a,
- 
 b) %7B%0A
-    
     return a
@@ -1099,61 +1099,237 @@
 ime;
- %7D);
+%0A%7D%0A
 %0Avar 
-rbt_timeline = new rbt.RBT(function (a, b) %7B
+mode, Timeline;%0Aswitch (process.argv%5B2%5D.toLowerCase()) %7B%0A    case 'bst':%0A        mode=%22BST%22;%0A        timeline = new bst.BST(vsort);%0A        break;%0A    case 'rbt':%0A        mode=%22RBT%22;%0A        timeline = new rbt.RBT(vsort);
 %0A   
@@ -1337,120 +1337,383 @@
     
+b
 re
-turn a.val.vruntime - b.val.vruntime; %7D);%0A%0Aconsole.log(%22Running with BST:%22);%0Arun_tasks(10, 10, bst_timeline
+ak;%0A    case 'heaptree':%0A        mode=%22HeapTree%22;%0A        timeline = new heaptree.HeapTree('min', vsort);%0A        break;%0A    case 'heaparray':%0A        mode=%22HeapArray%22;%0A        timeline = new heaparray.HeapArray('min', vsort);%0A        break;%0A    default:%0A        usage();%0A%7D%0A%0Avar start_factor = parseInt(process.argv%5B3%5D,10),%0A    end_factor = parseInt(process.argv%5B4%5D,10
 );%0A
+%0A
 cons
@@ -1737,14 +1737,16 @@
 with
- RBT:%22
+:%22, mode
 );%0Ar
@@ -1758,20 +1758,34 @@
 sks(
-10, 10, rbt_
+start_factor, end_factor, 
 time

Change run_tasks use args for tree, start and end factors.