100萬個電話號碼在文件裏,找出重複的;內存不足以放下所有數據。
將電話號碼轉爲數值型
數值代表位圖的偏移量
創建一個100,000,000/8+1大小的byte數組作爲位圖
num/8表示偏移量
num%8表示在該byte的第幾位
如果該位是0,置爲1
如果是1,已經重複
數值代表位圖的偏移量
創建一個100,000,000/8+1大小的byte數組作爲位圖
num/8表示偏移量
num%8表示在該byte的第幾位
如果該位是0,置爲1
如果是1,已經重複
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
180331 原型
simpleone_
2020-07-08 02:35:02
180328 正則表達式
simpleone_
2020-07-08 01:59:35
180406 客戶端JS WebAPI
simpleone_
2020-07-08 01:59:35
《JavaScript DOM 編程藝術(第二版)》筆記
simpleone_
2020-07-08 01:59:24
180405 demo
選項卡 <div class="wrapper"> <div class="search"> <input type="text"> Male: <input type="radio" cl
simpleone_
2020-07-08 01:59:24
POJ 3589 Number-guessing Game(簡單題)
V坚持
2020-07-06 23:18:35
Learning Redis - 概念
supermig
2020-07-04 15:49:13
atoi 和 itoa
#include <stdio.h> #include <stdlib.h> #include <assert.h> int atoi(const
_-U-_
2020-07-04 08:10:29
計算一個無符整數中bit位爲1的個數
1.循環法(Iterated Count) int bitcount (unsigned int n) { int count=0; while (n) { count += n & 0x1u
_-U-_
2020-07-04 08:10:29
前後臺分離項目的跨域問題
角谷
2020-07-03 21:00:52
nginx負載均衡、跨域、文件服務器配置
角谷
2020-07-03 21:00:52
Itext導出pdf教程
角谷
2020-07-03 21:00:52
win10默認瀏覽器設置重啓後失效
JQprince
2020-07-03 00:37:18
libjpeg-turbo的使用
Mirinda_cjy
2020-07-02 01:29:46