def get_50_percent(d):
    '''
    get 50% load percentage from a dictionary
    >>> get_50_percent({1:1,2:2,3:1})
    0.5
    '''
    exp = sorted(expand_num_dict(d))
    total_load = sum(exp)
    nodes = float(len(exp))
    acc = 0
    for i,l in enumerate(reversed(exp)):
        acc += l
        if(acc) >= total_load/2:
            break
    i+=1
    return i/nodes
    chord_monitor = []
    vserver_monitor = []
    for f in glob.glob(folder):
        if to_match in f:
            monitor = []
            for line in fileinput.input(f+"/control.queries"):
                if "monitorFreqs" in line:
                    monitor.append(line)
            if len(monitor) < 2:
                print "coudln't find loads for " + f
                continue
            monitor_d = []
            for i in monitor:
                monitor_d.append(get_num_dict(i))

            t_d = expand_num_dict(monitor_d[0]) 
            chord_monitor.append(float(sum(t_d))/len(t_d))
            t_d = expand_num_dict(monitor_d[1]) 
            vserver_monitor.append(float(sum(t_d))/len(t_d))

            x_values.append(next(get_numbers(f)))

    plt.figure().set_size_inches(6.5,5)
    plt.xlabel("#Nodes")
    plt.ylabel("#Monitored Nodes")

    from matplotlib.ticker import EngFormatter
    formatter = EngFormatter(places=0)
    plt.gca().xaxis.set_major_formatter(formatter)

    plt.xlim(0,1000000)