Implementation Skill 1 Oral Skill 6 La Te

  • Slides: 25
Download presentation
Implementation Skill 1 Oral Skill 6 La. Te. X Algorithm Definition/Lemma/Theorem/Corol lary/…

Implementation Skill 1 Oral Skill 6 La. Te. X Algorithm Definition/Lemma/Theorem/Corol lary/…

Method 2 Data Structure struct list_s { n Which one is better? Method 1

Method 2 Data Structure struct list_s { n Which one is better? Method 1 void sort(int *array, int size) { … } void main() { int *array; int size; }; typedef struct list_s list; void sort(list *a. List) { … } void main() { list *a. List; sort(array, size); } sort(a. List);

Data Structure n Method 1 n n n Adv? Disadv? Method 2 n n

Data Structure n Method 1 n n n Adv? Disadv? Method 2 n n Adv? Disadv?

Data Structure n List n Method n n n Insert Remove Size

Data Structure n List n Method n n n Insert Remove Size

Data Structure n Idea still applies on other “concepts” in your research

Data Structure n Idea still applies on other “concepts” in your research

Unit Test n n n Test each function separately E. g. An algorithm which

Unit Test n n n Test each function separately E. g. An algorithm which sorts the elements by iteratively finding the greatest element You can write a function called “find. Max(list)” Test Case 1: 1 2 4 10 Test Case 2: 10 4 2 1 Test Case 3: 4 1 10 2

Integration Test n n n After the unit test, you can go to “Integration

Integration Test n n n After the unit test, you can go to “Integration Test” which means that you need to “integrate” all parts of your methods E. g. while (a. List != null) { find. Max. Value. And. Max. Index(a. List, &max, &index); remove. Elt(a. List, index); }

Exercise 1 n Q 1: What test cases should you design for the sorting

Exercise 1 n Q 1: What test cases should you design for the sorting algorithms? Why? (Each algorithm may have different test cases. ) n n Q 2: Suppose you implement a list data structure with the following three operations. What test cases should you design for each operation? Why? n n Selection Sort (selecting the greatest no. ) Heap Sorting with B+-tree Insert Remove Size Please type them in La. Te. X

Algorithm Template n Please include the following libraries. usepackage{algorithm} n usepackage{algorithmic} (You can use

Algorithm Template n Please include the following libraries. usepackage{algorithm} n usepackage{algorithmic} (You can use the default libraries or your own libraries. ) n

Algorithm Template n An example: begin{algorithm}[tb] caption{Algorithm find. Mutual} label{alg: find. Mutual} begin{algorithmic} [1]

Algorithm Template n An example: begin{algorithm}[tb] caption{Algorithm find. Mutual} label{alg: find. Mutual} begin{algorithmic} [1] STATE $A leftarrow emptyset$ REPEAT IF{$A$ satisfies condition 1} STATE doing Step 1 a ELSE STATE doing Step 1 b ENDIF STATE doing Step 2 with $A$ STATE doing Step 3 UNTIL{$A = 10$} STATE return $A$ end{algorithmic} end{algorithm}

Definition/Lemma/Theorem/C orollary/… n Put the following at the beginning of the La. Te. X

Definition/Lemma/Theorem/C orollary/… n Put the following at the beginning of the La. Te. X file. n n You can also include the following. n n newtheorem{definition}{Definition} newtheorem{theorem}{Theorem} newtheorem{lemma}{Lemma} newtheorem{corollary}{Corollary} newtheorem{observation}{Observation} newtheorem{property}{Property} newtheorem{example}{Example} newtheorem{problem}{Problem} newtheorem{assumption}{Assumption} Please also include the following. n defdone{hspace*{fill} $framebox[2 mm]{}$ medskip}

Definition/Lemma/Theorem/C orollary/… n begin{definition}[Heap] This is a heap definition. A heap is a complete

Definition/Lemma/Theorem/C orollary/… n begin{definition}[Heap] This is a heap definition. A heap is a complete binary tree. label{def: heap} done end{definition}

Exercise 2 n Please try to type the algorithmic code which can display the

Exercise 2 n Please try to type the algorithmic code which can display the following and type it in La. Te. X (used in Exercise 1).

Exercise 2 n Please try to include two lemmas in the same La. Te.

Exercise 2 n Please try to include two lemmas in the same La. Te. X file n n n E. g. 1, LEMMA 1 (PERFECT). This is a perfect lemma. 1 + 1 = 2 E. g. 2, LEMMA 2 (NEWTON). This is a Newton’s principle. f = ma Try to use “label” in these lemmas and use “ref” to reference these lemmas in the main text

Exercise 2 (Reference) n For-loop n n FOR{…} … ENDFOR While-loop n WHILE{…} …

Exercise 2 (Reference) n For-loop n n FOR{…} … ENDFOR While-loop n WHILE{…} … ENDWHILE

Differences between Undergraduate and Postgraduate n About Jobs Done n In the undergraduate study,

Differences between Undergraduate and Postgraduate n About Jobs Done n In the undergraduate study, n after you finish the assignment/project, n n you must obtain some scores In the postgraduate study, n after you finish one paper, n n n if your paper is accepted finally, n you may approach your graduation if your paper is rejected finally, n you may not approach your graduation if the main idea of your paper is published in the other paper written by others, n your current paper will be wasted Why? n you cannot submit/publish this paper again n you may not approach your graduation

Differences between Undergraduate and Postgraduate n About Job Similarity n In the undergraduate study,

Differences between Undergraduate and Postgraduate n About Job Similarity n In the undergraduate study, n n different people in the class do the same assignment/project together In the postgraduate study, n different people in the world work on different papers This should be great! The paper you are doing does not collide with other papers. n accidentally, different people in the world work on papers with similar ideas Hot topics Good point: The ideas are very important. So, many people have these ideas and want to publish a paper Bad point: If a paper with these ideas written by others is published, then the paper with similar ideas you are working will be wasted.

Differences between Undergraduate and Postgraduate n About the Number of Jobs n In the

Differences between Undergraduate and Postgraduate n About the Number of Jobs n In the undergraduate study, n n n the number of assignments/projects are given by others (i. e. , instructors and teaching assistants) the amount of work to be done is given In the postgraduate study, n n Why? you need to write papers the number of papers you are working within your postgraduate study can be controlled by you In other words, if you are working more papers, then it is more likely that you have more papers accepted.

Differences between Undergraduate and Postgraduate n About Job Deadlines n In the undergraduate study,

Differences between Undergraduate and Postgraduate n About Job Deadlines n In the undergraduate study, n n the deadline of each assignment/project is set by others (i. e. , instructors and teaching assistants) In the postgraduate study, n n There is no exact deadline for each paper you are working You can do it at your own pace (fast or slow) Usually, the above observation is the key point to determine your productivity (i. e. , some students publish more papers while some publish fewer) Even though there are some conference/journal deadlines, if the paper you are working is incomplete, it is not possible to submit the paper.

Differences between Undergraduate and Postgraduate n About Job Quality n In the undergraduate study,

Differences between Undergraduate and Postgraduate n About Job Quality n In the undergraduate study, n n n you can do the assignment/project roughly and obtain a passing score sometimes, you may do the assignment/project perfectly and obtain nearly a full score In the postgraduate study, n n you must work on the paper to meet a high-standard requirement it is just like doing the assignment/project perfectly Why?

Differences between Undergraduate and Postgraduate n About Job Nature n In the undergraduate study,

Differences between Undergraduate and Postgraduate n About Job Nature n In the undergraduate study, n n each assignment/project is very concrete. the answer of the assignment/project has been done by teaching assistants. we know that the assignment/project can be finished. In the postgraduate study, n n n the paper you are working is totally new. nobody has tried it before (this is the reason why we need to do research) sometimes, you may feel frustrated if you cannot come up any good ideas. Don’t need to worry. We are working together to find a good path to walk. You are not walking alone. I am also walking with you to complete the task.

Exercise 3 – Part I n Please listen to the tape and follow the

Exercise 3 – Part I n Please listen to the tape and follow the intonation of the speaker n audio 10. mp 3 n In any event, a healthy adult should take his weight seriously and avoid both rapid loss and gain.

Exercise 3 – Part II n Please listen to the tape and follow the

Exercise 3 – Part II n Please listen to the tape and follow the intonation of the speaker n audio 11. mp 3 n n Read all scripts Please practise it and speak fluently next time

Exercise 3 – Part II n Today, I would like to focus on just

Exercise 3 – Part II n Today, I would like to focus on just one of the many heath problems young college students much like yourselves face on a day-to-day basis: weight loss and weight gain. Now, as you all aware, weight loss occurs when calorie intake is lower than calorie expenditure, whereas weight gain is just the opposite. There are both involuntary and deliberate reasons as to why a person might gain or lose weight. The former could be depression, parasite, or chronic illness; the latter might be dieting or a change in the level of physical activity. In any event, a healthy adult should take his weight seriously and avoid both rapid loss and gain.

Reminder n Please do exercise 1, exercise 2 and exercise 3.

Reminder n Please do exercise 1, exercise 2 and exercise 3.