Tutorial 5 Arrays Basics (1D, 2D) NUS SCHOOL OF COMPUTING CS1010E PROGRAMMING METHODOLOGY 1 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Quick Summary 2 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 1: Tracing Arrays 3 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 1: Tracing Arrays 4 List List299 num11 passElement(int num) num1234 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 1: Tracing Arrays 5 List List299 changeElements(int list[]) CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 1: Tracing Arrays 6 List List copyArray(list2, list1, 5) CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 2: Sieve Prime Numbers 7 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 2: Sieve Prime Numbers 8 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 2: Sieve Prime Numbers 9 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO Find the next Prime Number Use for loop to eliminate all the multiples of the prime number
Question 2: Sieve Prime Numbers 10 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 3: Pascal Triangle 11 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 3: Pascal Triangle 12 Element: Up Element: UpLeft CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 3: Pascal Triangle 13 Question: is it possible to fill up the triangle without considering the border values? Yes, we could initialize all the elements in the Pascal Triangle (2D Array) to 1 first. And our index starts from 1 instead of 0. CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 3: Pascal Triangle 14 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO
Question 3: Pascal Triangle 15 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO