课程名称:C for Everyone: Programming Fundamentals
课程内容:C/C++
课程网址:https://www.coursera.org/learn/c-for-everyone/home/week/1
课程进度:Week5
Week 5
Pointers and simple arrays
Aggregate总计的,总数的
Namely(adv.)即,也就是
Simple one-dimensional array type
Multiple(n.)倍数(adj.)数量多的,多种多样的
Somehow以某种方式
Individually单独地
Bracket [ ]
Generic一般的,通用的,普通的
Allocation分配
Retrieve检索,取回
Canonical典型的,经典的
Idiom成语,习语,惯用语
Initialize arrays
Int data[5];
Int data[5]={1,2,3,4,5};
Int data[5]={0};
Int data[]={1,2,3};
Curly brackets { }
Abbreviate(v.)缩写,缩略
Equivalent相同的,相等的
Concatenate(v.)连接(adj.)连在一起的
Sequentially按顺序,继续地,从而
Indicate指示,表明,显示
‘\0’
Char str[]=”a b c”; ‘a’ ‘ ‘ ‘b’ ‘ ‘ ‘c’
Sentinel或者guard用于寻找string结尾
In the declaration int data[1000] = {0}; all elements are initialized to 0.
Array-grade-code example
Aggregate总计的,总数的
Truncation截断,截尾,切断
Truncation error截断误差,舍位误差
Summation总和,总结,概括
Arbitrarily任意地,随意地
Humongous巨大的
Competent合格的
What is a pointer
Base address
Contiguously连续地
Allocate分配
Explicit明确的
Gigabyte千兆字节,十亿字节
Concrete确实的,具体的,实在的
Sake缘故,利益,原由
Interpret解释,口译
Oppose反对,抵制
Offset
Notion概念,观念,理解
Derive得到,获得
Int *p = &a; the address is being stored in p
Dereference间接引用,间接访问
Pointer code example
Urge敦促
Asterisk *
Ampersand &
Conceivably(adv.)可想而知,想得到地
Contextually(adv.)从上下文,根据上下文
Hexadecimal十六进制的 0x开头
%p对应指针类型 %lu对应long unsigned %lf对应double
Decimal(adj.)小数的,十进制的(n.)小数
The base type of a pointer affects how it looks at memory
pointer to int and pointer to double are different and this difference can affect both how much memory is pointed at – for example an int may be in 4 bytes and a double may be in 8 bytes
Call-by-reference simulated
Manipulate操纵,操作,控制,使用
Instance实例,例子,事例
Restate重申,重新表述
Mechanism机制,方法
Reverse使反转
Call by reference引用调用
Canonical典型的
Array as a parameter
Encapsulate压缩,概括,简述
Assume假设
Array-bubble-sort code
Sorting algorithm
Bubble sort冒泡排序
Namely即,也就是
Exhaustively彻底地
Exhausted耗尽的,筋疲力尽的,疲惫不堪的
Idiom惯用语
Halt暂停,停止,终止
Deduce(v.)推断,演绎,推论
Merge sort overview
Merge sort归并排序
Divide-and-conquer strategy
Principle原则,原理,规范
Phase阶段,时期
Phase程序,步骤,手续
Simultaneously(adv.)同时,联立,急切地
bubblesort is O(n*n) and mergesort is O(n log(n))
merge code-example1
embed把…嵌入,嵌进
simplify简化,使简易
assumption假设,假定
merge code example2(File include +)
arbitrary任意的
上图适用于2的倍数个数元素的数组
In the code for mergesort(), we call merge() 7 times if we are sorting 8 elements