基于visual Studio2013解决面试题之1204大数组查找
![](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAccAAAJSCAYAAAC2vw7fAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAADUSSURBVHhe7d0NkF3lfd/xv0RCahtHWq+zohhWSLOD2NSwopbQGAkiLAZh45VnSqTYSmSK04wh0UzSTuJ4KGnTgBlKO63TkS0ydZIhwnIi7HZiBYM8KCLlJRWo0YvHo6AoEivZBmuQpTVhAsRj+vzOy73P+d9z7svu3dVd7fczs9Leu/ee9/P8zvOc55wzx8zeDj8AACAz56qrlhKOAABE5mb/AwCADOEIAIBDOAIA4BCOAAA4hCMAAA7hCACAQzgCAOAQjgAAOIQjAAAO4QgAgEM4AgDgEI4AADiEIwAADuEIAIBDOAIA4BCOAAA4hCMAAA7hCACAQzgCAOAQjgAAOIQjAAAO4QgAgEM4AgDgEI4AADiEIwAADuEIAIBDOAIA4BCOAAA4szoc3/3ud9sf/uH/tPvu+z278sol2bsAgNluzlVXLX07+31WyYMxDsW//dsX7ctf3m5/+Zd77LXXXsveBQDMNrMyHMuCMaZg3LPnKfviFx+y733ve9m7AIDZYtaFY6tg9F54YZ99/es77c///OvZOwCA892sCsdOgzGm2uTKlTdkrwAA57NZ0yFnMsEo+j4AYHaYFeE42WAEAMwu532zajeD8eqrr8l+6w2XXHKJ/eqv3pn8/sgjX056256v/uiPvpT9Zsn5X84Bl/vt3/4tW7Ik3dZffPFF+8//+b8kv+e0P/zSL/1isj9oGapnNoBGPReO2nn1061eojt2/GnXaoydhqPC62MfW5e9smSeJlqoq0DTchGd/1QYPvvs/ym8d8stt563l6AcOrQ/+81s69aHws8fZK/ao+X0oQ/daMuXL0vWS0ydrhQk50NQ6EBQ8yiar1/+5V9Jfs/de+9/KmyT+rs+B6CoZ5pVVXjddded9sQTj9mjj/5pYQeeKBUE57Ip9Yc//GEItY1hvj6d/HzmM7+Z/aUzKsz13Xw4S5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vA++07+7JO+zUO78Mj95sc775v+xI/1V26SuPhXHn01T/eW1B/Ybdg4Pvtr/7m+jG1pqp4NUjr9uSj6+3a+YctG/mNx6XpLnWbPcjx+w9S8btm1/633Z25JP24YET9ve2mA45AHCO9exNAIZHQ61u7347G2p5+04vLn24sGpb6QOI0ye2+9c1A0O2yOrPbTy8M9QW+/Vw4WOltbLk71kFdN7S27IH6RZ/1kQXVB5+pthcmtN9YJOPuYflDg/NCzXXYo1QT64va75NqRbJo5IAYLr0YDimQTB0tB5Qegp/8gBflwyF4Foz2PA6N3DF5VZ8bmMYx7IQUHtbN1gWAjf6af5QXTXLhgC1p9LP7zhjy8LrfPLj8PX0LMaGnrHDy23p2TCsHQdtvp7RCACYUj0Wjv3JucG+fe78XJA8wPfo4kJAVgVX8hPVHPv7Qu0zTqMQNouOP1kZUJXUsSYL3zULT1jp84vVZJo8bDlMQz4T2RP6de5xc+EhwWXSYN28+TZbmtd2D79gB+avts0bRlo+NBkAMHk9dIccAAB6AzceBwDAIRwBAHAIRwAAHMIRAACHcAQAwCEcAQBwCEcAABzCEQAAh3AEAMAhHAEAcAhHAAAcwhEAAIdwBADAIRwBAHAIRwAAHMIRAACHcAQAwCEcAQBwCEcAABzCEQAAh3AEAMAhHAEAcAhHAAAcwhEAAIdwBADAIRwBAHAIRwAAHMIRAACHcAQAwCEcAQBwCEcAABzCEQAAh3AEAMAhHAEAcAhHAAAcwhEAAIdwBADAIRwBAHAIRwAAHMIRAACHcAQAoMDs/wPVKhnz8zxsGwAAAABJRU5ErkJggg==)
题目
解决代码及点评
/* 有40亿个整数,在文件里保存,现在要找出这个文件里没有的某个整数,找到一个就行 这个40亿个整数大概要花掉4G内存,全部读出来是不可取的 我们可以通过位域来标记哪些存在哪些不存在 这样一个整数可以表示32个整数的存在情况,需要的内存是4G/32 = 1G/8 = 128M 然后将整数一个个读出来,根据整数的值,标记位域,最后再查找位域,哪个位置是0即可 */ #include <iostream> #include <stdio.h> using namespace std; #define BITSPERWORD 32 #define SHIFT 5 #define MASK 0x1F #define N 10000000 int a[1 + N/BITSPERWORD]; void set(int i) { a[i>>SHIFT] |= (1 <<(i & MASK)); //第i位清零 } void clr(int i) { a[i>>SHIFT] &= ~(1 <<(i & MASK)); //第i位1 } int test(int i) { return a[i>>SHIFT] & (1 <<(i & MASK)); } int main(){ int i; for (i = 0; i < N; i++) clr(i); while (scanf_s("%d", &i) != EOF) set(i); i = 0; while(i<N) { if (test(i)) cout<< i<<" "; i++; } system("pause"); return 0; }
代码下载及其运行
代码下载地址:http://download.csdn.net/detail/yincheng01/6704519
解压密码:c.itcast.cn
下载代码并解压后,用VC2013打开interview.sln,并设置对应的启动项目后,点击运行即可,具体步骤如下:
1)设置启动项目:右键点击解决方案,在弹出菜单中选择“设置启动项目”
2)在下拉框中选择相应项目,项目名和博客编号一致
3)点击“本地Windows调试器”运行
程序运行结果