编程珠玑-如何给10^7个数据量的磁盘文件排序

来源:互联网 发布:36周b超羊水正常数据 编辑:程序博客网 时间:2024/06/03 01:52
http://blog.csdn.net/v_JULY_v/article/details/6451990
http://tudian2007.blog.163.com/blog/static/3156641320128116561981/






  1. /磁盘文件排序位图方案的伪代码  
  2. //copyright@ Jon Bentley  
  • //July、updated,2011.05.29。  
  •   
  • //第一步,将所有的位都初始化为0  
  • for i ={0,....n}      
  •    bit[i]=0;  
  • //第二步,通过读入文件中的每个整数来建立集合,将每个对应的位都置为1。  
  • for each i in the input file     
  •    bit[i]=1;  
  •   
  • //第三步,检验每一位,如果该位为1,就输出对应的整数。  
  • for i={0...n}      
  •   if bit[i]==1        
  •     write i on the output file  
    
  • 0 0
    原创粉丝点击