- 博客(14)
- 资源 (35)
- 收藏
- 关注
原创 problem 2
Problem 219 October 2001Each new term in the Fibonaccisequence is generated by adding the previous two terms. By starting with 1 and2, the first 10 terms will be:1, 2, 3, 5, 8, 13, 21, 34, 55,89
2012-06-22 10:49:27 457
原创 problem 1
Problem 105 October 2001If we list all the naturalnumbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum ofthese multiples is 23.Find the sum of all the multiplesof 3 or 5
2012-06-22 10:46:04 491
转载 位域
位域 有些信息在存储时,并不需要占用一个完整的字节,而只需占几个或一个二进制位。例如在存放一个开关量时,只有0和1两种状态,用一位二进位即可。为了节省存储空间,并使处理简便,C语言又提供了一种数据结构,称为“位域”或“位段”。所谓“位域”是把一个字节中的二进位划分为几个不同的区域,并说明每个区域的位数。每个域有一个域名,允许在程序中按域名进行操作。这样就可以把几
2012-06-22 10:13:05 551
原创 merge sort
时间复杂度:O(nlogn)void merge(int A[], int low, int mid, int high){ int len = high-low+1; int* B = (int*)malloc(len*sizeof(int)); if (!B) printf("Failed to allocate memory\n"); int* pB = B; in
2012-06-20 13:57:50 679
转载 我是如何一年写出三本编程书籍的
我是如何一年写出三本编程书籍的本文的作者 Chris Strom像大多数程序员一样,我是一个内向的人,所以,像下面这样的话很难说出口:我是个了不起的人。哦…. 不得不多说几句。我看到Ruby,Javascript和其它社区里有这么多杰出的人物,他们真的让人非常的佩服,而我呢,我感到自己一无是处。但即使这样,回首过去一年的366天,我所做的事情
2012-06-16 00:47:03 1480
原创 输出整数n的二进制形式
输出整数n的二进制形式:如:0 输出 01 输出 12 输出 1010 输出 1010数组方式:void print_binary(int n){ char arr[32] = {0}; int len = 0; do { arr[len++] = (n&1)+'0', n = n>>1; } while (n); while (len-
2012-06-15 14:37:17 3774
原创 heap sort
// heap_sort.h// 大堆排序#ifndef _HEAP_SORT_H_#define _HEAP_SORT_H_#include "utility.h"/* 左节点 */int tree_left(int i){ return 2 * i + 1;}/* 右节点 */int tree_right(int i){ return (2 * i + 2);
2012-06-14 14:55:37 854
原创 stack
// stack.h#ifndef _STACK_H_#define _STACK_H_#define MAX_STACK 10typedef int T;typedef struct { T *data; int st;} STACK;STACK *createstack();int push(STACK * s, T e);T* pop(STACK *s);
2012-06-14 00:44:24 580
原创 binary search
#include #define print_seek_result(key, index) \{printf("Found %d at position %d\n", key, index);}#define ARR_SIZE(arr) sizeof(arr)/sizeof(arr[0])#define KEY_NOT_FOUND -1int binary_search(int
2012-06-13 21:35:34 568
原创 链表反转
#include struct Node{ int data; struct Node *pNext;};void print_List(struct Node *pHead){ struct Node *pNode = pHead; while (pNode) { printf("%d, ", pNode->data); pNode = pNode->pNext;
2012-06-13 15:52:32 821
原创 结构体内存对齐
结构体内存对齐,主要是为了CPU能更快速的提取数据所谓的对齐,指结构体及其成员的内存起始地址address应为要对齐大小X的倍数, 即address = kX假设 n 为编译器设定的对齐大小, item为结构体中成员类型,那么实际对齐的大小值,计算如下:X = min(n, sizeof(item))--------------------
2012-06-13 14:46:00 1237
原创 quick sort
#include #define ARR_SIZE(arr) sizeof(arr)/sizeof(arr[0])#define CHIRS_CODEvoid print_arr(int arr[], int len){ int i=0; for (;i<len;i++) printf("%d, ", arr[i]); printf("\n");} void quick
2012-06-10 22:43:12 672
原创 selection sort
选择排序算法, 一种简单的排序算法复杂度: O(n^2)伪代码:procedure selectSort( A : list of sortable items ) n = length(A) for i=0 to n-1 inclusive do min = i for j = i+1 to n inclusive do if A[j] <
2012-06-07 10:39:50 1708
原创 Bubble Sort
冒泡算法, 一种简单的排序算法复杂度: O(n^2)伪代码:bubbleSort( A : list of sortable items ) n = length(A) repeat swapped = false for i = 1 to n-1 inclusive do if A[i-1] > A[i] then
2012-06-06 15:40:27 881
sms develop
2014-06-17
MemoryMonitor(内存监测)
2012-03-22
MS Visual Studio C++ 开发资源版本信息设置
2012-03-21
SignTool(程序签名工具)
2011-03-22
CListCtrlExDemo.rar
2009-02-22
mathematica 5
2009-01-08
VCHOME资料集
2007-08-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人