10个经典的C语言面试基础算法及代码作者:码农网 – 小峰

原文地址:http://www.codeceo.com/article/10-c-interview-algorithm.html

算法是一个程序和软件的灵魂,作为一名优秀的程序员,只有对一些基础的算法有着全面的掌握,才会在设计程序和编写代码的过程中显得得心应手。本文是近百个C语言算法系列的第二篇,包括了经典的Fibonacci数列、简易计算器、回文检查、质数检查等算法。也许他们能在你的毕业设计或者面试中派上用场。

1、计算Fibonacci数列

Fibonacci数列又称斐波那契数列,又称黄金分割数列,指的是这样一个数列:1、1、2、3、5、8、13、21。

C语言实现的代码如下:

  1. /* Displaying Fibonacci sequence up to nth term where n is entered by user. */#include <stdio.h>int main()
    {
  2. int count, n, t1=0, t2=1, display=0;
  3. printf("Enter number of terms: ");
  4. scanf("%d",&n);
  5. printf("Fibonacci Series: %d+%d+", t1, t2); /* Displaying first two terms */
  6. count=2; /* count=2 because first two terms are already displayed. */
  7. while (count<n)
  8. {
  9. display=t1+t2;
  10. t1=t2;
  11. t2=display;
  12. ++count;
  13. printf("%d+",display);
  14. }
  15. return 0;
    }

结果输出:

  1. Enter number of terms: 10
    Fibonacci Series: 0+1+1+2+3+5+8+13+21+34+

也可以使用下面的源代码:

  1. /* Displaying Fibonacci series up to certain number entered by user. */
  2. #include <stdio.h>
    int main()
    {
  3. int t1=0, t2=1, display=0, num;
  4. printf("Enter an integer: ");
  5. scanf("%d",&num);
  6. printf("Fibonacci Series: %d+%d+", t1, t2); /* Displaying first two terms */
  7. display=t1+t2;
  8. while(display<num)
  9. {
  10. printf("%d+",display);
  11. t1=t2;
  12. t2=display;
  13. display=t1+t2;
  14. }
  15. return 0;
    }

结果输出:

  1. Enter an integer: 200Fibonacci Series: 0+1+1+2+3+5+8+13+21+34+55+89+144+

2、回文检查

源代码:

  1. /* C program to check whether a number is palindrome or not */
  2. #include <stdio.h>
    int main()
    {
  3. int n, reverse=0, rem,temp;
  4. printf("Enter an integer: ");
  5. scanf("%d", &n);
  6. temp=n;
  7. while(temp!=0)
  8. {
  9. rem=temp%10;
  10. reverse=reverse*10+rem;
  11. temp/=10;
  12. }
    /* Checking if number entered by user and it's reverse number is equal. */
  13. if(reverse==n)
  14. printf("%d is a palindrome.",n);
  15. else
  16. printf("%d is not a palindrome.",n);
  17. return 0;
    }

结果输出:

  1. Enter an integer: 1232112321 is a palindrome.

3、质数检查

注:1既不是质数也不是合数。

源代码:

  1. /* C program to check whether a number is prime or not. */#include <stdio.h>int main(){
  2. int n, i, flag=0;
  3. printf("Enter a positive integer: ");
  4. scanf("%d",&n);
  5. for(i=2;i<=n/2;++i)
  6. {
  7. if(n%i==0)
  8. {
  9. flag=1;
  10. break;
  11. }
  12. }
  13. if (flag==0)
  14. printf("%d is a prime number.",n);
  15. else
  16. printf("%d is not a prime number.",n);
  17. return 0;
    }

结果输出:

  1. Enter a positive integer: 29
    29 is a prime number.

4、打印金字塔和三角形

使用 * 建立三角形

  1. *
    * *
    * * *
    * * * *
    * * * * *

源代码:

  1. #include <stdio.h>
    int main()
    {
  2. int i,j,rows;
  3. printf("Enter the number of rows: ");
  4. scanf("%d",&rows);
  5. for(i=1;i<=rows;++i)
  6. {
  7. for(j=1;j<=i;++j)
  8. {
  9. printf("* ");
  10. }
  11. printf("\n");
  12. }
  13. return 0;
    }

如下图所示使用数字打印半金字塔。

  1. 1
    1 2
    1 2 3
    1 2 3 4
    1 2 3 4 5

源代码:

  1. #include <stdio.h>
    int main()
    {
  2. int i,j,rows;
  3. printf("Enter the number of rows: ");
  4. scanf("%d",&rows);
  5. for(i=1;i<=rows;++i)
  6. {
  7. for(j=1;j<=i;++j)
  8. {
  9. printf("%d ",j);
  10. }
  11. printf("\n");
  12. }
  13. return 0;
    }

用 * 打印半金字塔

  1. * * * * *
    * * * *
    * * *
    * *
    *

源代码:

  1. #include <stdio.h>
    int main()
    {
  2. int i,j,rows;
  3. printf("Enter the number of rows: ");
  4. scanf("%d",&rows);
  5. for(i=rows;i>=1;--i)
  6. {
  7. for(j=1;j<=i;++j)
  8. {
  9. printf("* ");
  10. }
  11. printf("\n");
  12. }
  13. return 0;
    }

用 * 打印金字塔

  1. *
  2. * * *
  3. * * * * *
  4. * * * * * * *
    * * * * * * * * *

源代码:

  1. #include <stdio.h>
    int main()
    {
  2. int i,space,rows,k=0;
  3. printf("Enter the number of rows: ");
  4. scanf("%d",&rows);
  5. for(i=1;i<=rows;++i)
  6. {
  7. for(space=1;space<=rows-i;++space)
  8. {
  9. printf(" ");
  10. }
  11. while(k!=2*i-1)
  12. {
  13. printf("* ");
  14. ++k;
  15. }
  16. k=0;
  17. printf("\n");
  18. }
  19. return 0;
    }

用 * 打印倒金字塔

  1. * * * * * * * * *
  2. * * * * * * *
  3. * * * * *
  4. * * *
  5. *

源代码:

  1. #include<stdio.h>
    int main()
    {
  2. int rows,i,j,space;
  3. printf("Enter number of rows: ");
  4. scanf("%d",&rows);
  5. for(i=rows;i>=1;--i)
  6. {
  7. for(space=0;space<rows-i;++space)
  8. printf(" ");
  9. for(j=i;j<=2*i-1;++j)
  10. printf("* ");
  11. for(j=0;j<i-1;++j)
  12. printf("* ");
  13. printf("\n");
  14. }
  15. return 0;
    }

5、简单的加减乘除计算器

源代码:

  1. /* Source code to create a simple calculator for addition, subtraction, multiplication and division using switch...case statement in C programming. */
    # include <stdio.h>
    int main()
    {
  2. char o;
  3. float num1,num2;
  4. printf("Enter operator either + or - or * or divide : ");
  5. scanf("%c",&o);
  6. printf("Enter two operands: ");
  7. scanf("%f%f",&num1,&num2);
  8. switch(o) {
  9. case '+':
  10. printf("%.1f + %.1f = %.1f",num1, num2, num1+num2);
  11. break;
  12. case '-':
  13. printf("%.1f - %.1f = %.1f",num1, num2, num1-num2);
  14. break;
  15. case '*':
  16. printf("%.1f * %.1f = %.1f",num1, num2, num1*num2);
  17. break;
  18. case '/':
  19. printf("%.1f / %.1f = %.1f",num1, num2, num1/num2);
  20. break;
  21. default:
  22. /* If operator is other than +, -, * or /, error message is shown */
  23. printf("Error! operator is not correct");
  24. break;
  25. }
  26. return 0;
    }

结果输出:

  1. Enter operator either + or - or * or divide : -
    Enter two operands: 3.4
    8.43.4 - 8.4 = -5.0

6、检查一个数能不能表示成两个质数之和

源代码:

  1. #include <stdio.h>
    int prime(int n);
    int main()
    {
  2. int n, i, flag=0;
  3. printf("Enter a positive integer: ");
  4. scanf("%d",&n);
  5. for(i=2; i<=n/2; ++i)
  6. {
  7. if (prime(i)!=0)
  8. {
  9. if ( prime(n-i)!=0)
  10. {
  11. printf("%d = %d + %d\n", n, i, n-i);
  12. flag=1;
  13. }
  14. }
  15. }
  16. if (flag==0)
  17. printf("%d can't be expressed as sum of two prime numbers.",n);
  18. return 0;}int prime(int n) /* Function to check prime number */{
  19. int i, flag=1;
  20. for(i=2; i<=n/2; ++i)
  21. if(n%i==0)
  22. flag=0;
  23. return flag;
    }

结果输出:

  1. Enter a positive integer: 34
    34 = 3 + 31
    34 = 5 + 29
    34 = 11 + 23
    34 = 17 + 17

7、用递归的方式颠倒字符串

源代码:

  1. /* Example to reverse a sentence entered by user without using strings. */
    #include <stdio.h>
    void Reverse();
    int main()
    {
  2. printf("Enter a sentence: ");
  3. Reverse();
  4. return 0;
    }
    void Reverse()
    {
  5. char c;
  6. scanf("%c",&c);
  7. if( c != '\n')
  8. {
  9. Reverse();
  10. printf("%c",c);
  11. }
    }

结果输出:

  1. Enter a sentence: margorp emosewa
  2. awesome program

8、实现二进制与十进制之间的相互转换

  1. /* C programming source code to convert either binary to decimal or decimal to binary according to data entered by user. */
  2. #include <stdio.h>
    #include <math.h>
    int binary_decimal(int n);
    int decimal_binary(int n);
    int main()
    {
  3. int n;
  4. char c;
  5. printf("Instructions:\n");
  6. printf("1. Enter alphabet 'd' to convert binary to decimal.\n");
  7. printf("2. Enter alphabet 'b' to convert decimal to binary.\n");
  8. scanf("%c",&c);
  9. if (c =='d' || c == 'D')
  10. {
  11. printf("Enter a binary number: ");
  12. scanf("%d", &n);
  13. printf("%d in binary = %d in decimal", n, binary_decimal(n));
  14. }
  15. if (c =='b' || c == 'B')
  16. {
  17. printf("Enter a decimal number: ");
  18. scanf("%d", &n);
  19. printf("%d in decimal = %d in binary", n, decimal_binary(n));
  20. }
  21. return 0;
    }
  22. int decimal_binary(int n) /* Function to convert decimal to binary.*/
    {
  23. int rem, i=1, binary=0;
  24. while (n!=0)
  25. {
  26. rem=n%2;
  27. n/=2;
  28. binary+=rem*i;
  29. i*=10;
  30. }
  31. return binary;
    }
  32. int binary_decimal(int n) /* Function to convert binary to decimal.*/
    {
  33. int decimal=0, i=0, rem;
  34. while (n!=0)
  35. {
  36. rem = n%10;
  37. n/=10;
  38. decimal += rem*pow(2,i);
  39. ++i;
  40. }
  41. return decimal;
    }

结果输出:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkJDQzA1MTVGNkE2MjExRTRBRjEzODVCM0Q0NEVFMjFBIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkJDQzA1MTYwNkE2MjExRTRBRjEzODVCM0Q0NEVFMjFBIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QkNDMDUxNUQ2QTYyMTFFNEFGMTM4NUIzRDQ0RUUyMUEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QkNDMDUxNUU2QTYyMTFFNEFGMTM4NUIzRDQ0RUUyMUEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6p+a6fAAAAD0lEQVR42mJ89/Y1QIABAAWXAsgVS/hWAAAAAElFTkSuQmCC" alt="" data-w="497" data-ratio="0.2454728370221328" data-type="png" data-src="http://mmbiz.qpic.cn/mmbiz/gPKgoIgeYlPWqZXNUicmTuIGYHsFEPzb7glwZpILBx9ia5y9IlSVIXST40bibmdRurllvBcAiaviaUaEhaeNcqGzOvQ/0?wx_fmt=png" data-s="300,640" />

9、使用多维数组实现两个矩阵的相加

源代码:

  1. #include <stdio.h>
    int main()
    {
  2. int r,c,a[100][100],b[100][100],sum[100][100],i,j;
  3. printf("Enter number of rows (between 1 and 100): ");
  4. scanf("%d",&r);
  5. printf("Enter number of columns (between 1 and 100): ");
  6. scanf("%d",&c);
  7. printf("\nEnter elements of 1st matrix:\n");/* Storing elements of first matrix entered by user. */
  8. for(i=0;i<r;++i)
  9. for(j=0;j<c;++j)
  10. {
  11. printf("Enter element a%d%d: ",i+1,j+1);
  12. scanf("%d",&a[i][j]);
  13. }/* Storing elements of second matrix entered by user. */
  14. printf("Enter elements of 2nd matrix:\n");
  15. for(i=0;i<r;++i)
  16. for(j=0;j<c;++j)
  17. {
  18. printf("Enter element a%d%d: ",i+1,j+1);
  19. scanf("%d",&b[i][j]);
  20. }/*Adding Two matrices */
  21. for(i=0;i<r;++i)
  22. for(j=0;j<c;++j)
  23. sum[i][j]=a[i][j]+b[i][j];/* Displaying the resultant sum matrix. */
  24. printf("\nSum of two matrix is: \n\n");
  25. for(i=0;i<r;++i)
  26. for(j=0;j<c;++j)
  27. {
  28. printf("%d ",sum[i][j]);
  29. if(j==c-1)
  30. printf("\n\n");
  31. }
  32. return 0;
    }

结果输出:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkJDQzA1MTVGNkE2MjExRTRBRjEzODVCM0Q0NEVFMjFBIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkJDQzA1MTYwNkE2MjExRTRBRjEzODVCM0Q0NEVFMjFBIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QkNDMDUxNUQ2QTYyMTFFNEFGMTM4NUIzRDQ0RUUyMUEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QkNDMDUxNUU2QTYyMTFFNEFGMTM4NUIzRDQ0RUUyMUEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6p+a6fAAAAD0lEQVR42mJ89/Y1QIABAAWXAsgVS/hWAAAAAElFTkSuQmCC" alt="" data-w="388" data-ratio="0.7963917525773195" data-type="png" data-src="http://mmbiz.qpic.cn/mmbiz/gPKgoIgeYlPWqZXNUicmTuIGYHsFEPzb7kMV6bOvpia02CwnnG0tqPtraT2s1Gn3NXYcafd600yL8iaQicB4pyPj9g/0?wx_fmt=png" data-s="300,640" />

10、矩阵转置

源代码:

  1. #include <stdio.h>
    int main()
    {
  2. int a[10][10], trans[10][10], r, c, i, j;
  3. printf("Enter rows and column of matrix: ");
  4. scanf("%d %d", &r, &c);/* Storing element of matrix entered by user in array a[][]. */
  5. printf("\nEnter elements of matrix:\n");
  6. for(i=0; i<r; ++i)
  7. for(j=0; j<c; ++j)
  8. {
  9. printf("Enter elements a%d%d: ",i+1,j+1);
  10. scanf("%d",&a[i][j]);
  11. }/* Displaying the matrix a[][] */
  12. printf("\nEntered Matrix: \n");
  13. for(i=0; i<r; ++i)
  14. for(j=0; j<c; ++j)
  15. {
  16. printf("%d ",a[i][j]);
  17. if(j==c-1)
  18. printf("\n\n");
  19. }/* Finding transpose of matrix a[][] and storing it in array trans[][]. */
  20. for(i=0; i<r; ++i)
  21. for(j=0; j<c; ++j)
  22. {
  23. trans[j][i]=a[i][j];
  24. }/* Displaying the transpose,i.e, Displaying array trans[][]. */
  25. printf("\nTranspose of Matrix:\n");
  26. for(i=0; i<c; ++i)
  27. for(j=0; j<r; ++j)
  28. {
  29. printf("%d ",trans[i][j]);
  30. if(j==r-1)
  31. printf("\n\n");
  32. }
  33. return 0;
    }

结果输出:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkJDQzA1MTVGNkE2MjExRTRBRjEzODVCM0Q0NEVFMjFBIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkJDQzA1MTYwNkE2MjExRTRBRjEzODVCM0Q0NEVFMjFBIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QkNDMDUxNUQ2QTYyMTFFNEFGMTM4NUIzRDQ0RUUyMUEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QkNDMDUxNUU2QTYyMTFFNEFGMTM4NUIzRDQ0RUUyMUEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6p+a6fAAAAD0lEQVR42mJ89/Y1QIABAAWXAsgVS/hWAAAAAElFTkSuQmCC" alt="" data-w="404" data-ratio="0.9381188118811881" data-type="png" data-src="http://mmbiz.qpic.cn/mmbiz/gPKgoIgeYlPWqZXNUicmTuIGYHsFEPzb7xLmLTEMP5JJMQd6pkAN8nOib9Xkz9NlLaJnWMlKtt200QECjkOkk5tQ/0?wx_fmt=png" />

10个经典的C语言面试基础算法及代码的更多相关文章

  1. C语言面试基础知识整理

    一.预处理 1.什么是预编译?何时需要预编译? (1)预编译又称预处理,是做些代码文本的替换工作,即程序执行前的一些预处理工作.主要处理#开头的指令,如拷贝#include包含的文件代码.替换#def ...

  2. C语言经典面试题 与 C语言面试宝典

    1 预处理 问题1:什么是预编译?何时需要预编译? 答: 预编译又称预处理,是整个编译过程最先做的工作,即程序执行前的一些预处理工作.主要处理#开头的指令.如拷贝#include包含的文件代码.替换# ...

  3. C语言的10大基础算法

    C语言的10大基础算法 算法是一个程序和软件的灵魂,作为一名优秀的程序员,只有对一些基础的算法有着全面的掌握,才会在设计程序和编写代码的过程中显得得心应手.本文包括了经典的Fibonacci数列.简易 ...

  4. c/c++面试总结---c语言基础算法总结2

    c/c++面试总结---c语言基础算法总结2 算法是程序设计的灵魂,好的程序一定是根据合适的算法编程完成的.所有面试过程中重点在考察应聘者基础算法的掌握程度. 上一篇讲解了5中基础的算法,需要在面试之 ...

  5. c/c++面试指导---c语言基础算法总结1

    c语言基础算法总结 1  初学者学习任何一门编程语言都必须要明确,重点是学习编程方法和编程思路,不是学习语法规则,语法规则是为编程实现提供服务和支持.所以只要认真的掌握了c语言编程方法,在学习其它的语 ...

  6. c语言面试宝典(经典,超详细)

    c语言面试宝典(经典,超详细) 2018年08月25日 09:32:19 chengxuyuan997 阅读数:7799   摘自:https://blog.csdn.net/chengxuyuan9 ...

  7. [易学易懂系列|rustlang语言|零基础|快速入门|(10)|Vectors容器]

    [易学易懂系列|rustlang语言|零基础|快速入门|(10)] 有意思的基础知识 Vectors 我们之前知道array数组是定长,只可我保存相同类型的数据的数据类型. 如果,我们想用不定长的数组 ...

  8. C语言面试

    最全的C语言试题总结 第一部分:基本概念及其它问答题 1.关键字static的作用是什么? 这个简单的问题很少有人能回答完全.在C语言中,关键字static有三个明显的作用: 1). 在函数体,一个被 ...

  9. 快速掌握JavaScript面试基础知识(三)

    译者按: 总结了大量JavaScript基本知识点,很有用! 原文: The Definitive JavaScript Handbook for your next developer interv ...

随机推荐

  1. javaSwing文本框组件

    public class JTextFieldTest extends JFrame{    private static final long serialVersionUID = 1L;    p ...

  2. 55. Set Matrix Zeroes

    Set Matrix Zeroes (Link: https://oj.leetcode.com/problems/set-matrix-zeroes/) Given a m x n matrix, ...

  3. Apache性能优化、超时设置,linux 重启apache

    在httpd.conf中去掉Include conf/extra/httpd-default.conf前的#以使httpd-default.php生效.其中调节以下参数Timeout 15 (连接超时 ...

  4. CentOS的安装与克隆

    CentOS的安装与克隆 环境说明 win7 x64位:VMware12:CentOS-6.5-x86_64-minimal 安装与初始配置 安装 在WM主页--“创建新的虚拟机”--自定义--... ...

  5. 为什么C++中空类和空结构体大小为1?(转载)

    原文链接:http://www.spongeliu.com/260.html 对于结构体和空类大小是1这个问题,首先这是一个C++问题,在C语言下空结构体大小为0(当然这是编译器相关的).这里的空类和 ...

  6. yum命令指南

    yum check-update  检查可更新的所有软件包 yum update  下载更新系统已安装的所有软件包yum upgrade  大规模的版本升级,与yum update不同的是,连旧的淘汰 ...

  7. window date type

    Most string operations can use the same logic for Unicode and for Windows code pages. The only diffe ...

  8. WebForm 简单控件、复合控件

    简单控件: Label:被编译成span 样式表里设置lable的高度:  display:inline-block; Text  --文本 ForeColor  --字体颜色 Visible  -- ...

  9. ubuntu下安装迅雷

    ----------------------------------2016-03-28新增适用于ubuntu16.04系列的安装包---------------------------------- ...

  10. JAVA学习<六>

    1.Java中的局部变量和成员变量: 2.变量同名,优先方法的局部变量. 3. 4.构造方法: 5.Java 中的 static 使用之静态变量: Java 中被 static 修饰的成员称为静态成员 ...