Datastructure c++ note 2
2005-12-02 16:17
288 查看
ASCII | DECIMAL | BINARY |
空格 | 32 | 0010 0000 |
十进制数码 | 48 – 57 | 0110 0000 |
大写字母 | 65 – 90 | 0100 0001 |
小写字母 | 97 - 122 | |
2. enum Boolean {False , True };Boolean Done = False;
3. char *pName = “c://china.exe”; Char *p = strrchr(pName, ‘//’) + 1;
4. 变量在使用前要初始化数组在使用之前一定要初始化 char *myArr = "this is my first word program!";
char arr[50];memset(arr, 0, 50);int arr[50];for (int i=0; i<50; i++) arr[i] = 0;
myArr 0x004240c8 "this is my first word program!" char *
myArr 0x004240c8 "this is my first word program!" char *arr 0x0012fe88 "烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫this is my first word program!" char [50]
5.
//顺序查找(循环多次)
int SeqSearch(int arr[], int start, int n, int key)
{
int pos = -1;
for (int i = start; i < n; i++)
{
if (arr[i] == key)
pos = i;
}
return pos;
}
//顺序查找
int SeqSearch2(int arr[], int start, int n, int key)
{
for (int i=start; i<n; i++)
{
if (arr[i] == key)
return i;
}
return -1;
}
//重复查找
int searchCount(int arr[], int start, int n, int key)
{
int pos = 0;
int count = 0;
while ((pos = SeqSearch2(arr, pos, n, key)) != -1)
{
count ++;
//找到后指针后移
pos ++;
}
return count;
}
相关文章推荐
- C++ Data Structure 学习笔记 (2011.5.2)——Cin的用法详解以及文件的读取
- LeetCode-Add and Search Word - Data structure design(C++)
- 《Data Structure And Algorithm Analysis In C++》读书笔记二
- C++ POD ~ plain data structure
- 《Data Structure And Algorithm Analysis In C++》读书笔记一
- basic C++ knowledge prepared for data structure (1)
- An implementation of the skip list data structure written in C++
- C++ 读取文件内容到data 结构体 structure
- C++ data structure
- basic C++ knowledge prepared for data structure (2)
- 《Data Structure And Algorithm Analysis In C++》读书笔记四
- 《Data Structure And Algorithm Analysis In C++》读书笔记三
- Building a 3D Portal Engine 笔记之(1) Data Structure For 3D Graphics
- Build Tree View Structure for SharePoint List Data
- UVa 11995:I Can Guess the Data Structure!(数据结构练习)
- leetcode 211: Add and Search Word - Data Structure Design
- 211. Add and Search Word - Data structure design
- Datastructure c++ note 1
- [Study Note] TDD: Consistent test structure (测试代码的结构一致性)
- Finish Data Structure Examination