14.txt

来自「一個計算機系教授的上課講義 主要是教導學生使用C語言編寫程序」· 文本 代码 · 共 31 行

TXT
31
字号
CS 1355
Introduction to Programming in C
Thursday 2006.10.24 (Week 7)
Lecture notes (at http://r638-2.cs.nthu.edu.tw/C/notes/14.txt)

Chapter 6: Arrays (continued)

- search: linear vs binary search
- multiple-subscripted arrays

What is "search"
- look up a data record using a "key"
- what is a key? 
  example: name, student ID, product number etc.
- input: key
- output: data record, or "not found"

Linear Search:
- go through array from beginning, 
  as soon as we find a match, return.

Example:
#include <stdio.h>
#define SIZE 14
int key[ ] = {
	1101, 1102, 1103, 1104, 1107, 
	1108, 1109, 1110, 1201, 1203, 
	1207, 1210, 1213, 1215
};
char* company[ ] = {
	"

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?