Tutorial 5 Arrays Basics (1D, 2D) NUS SCHOOL OF COMPUTING CS1010E PROGRAMMING METHODOLOGY 1 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO.

Slides:



Advertisements
Similar presentations
Copyright © 2002 Pearson Education, Inc. Slide 1.
Advertisements

Sorting algorithms Sieve of Eratosthenes
Test practice Multiplication. Multiplication 9x2.
An Array A sequence of elements of a particular type Each element in the array has an index which gives its position in the sequence An array is declared.
1. What number does the following array represent?
Lists Samuel Marateck © The Sieve of Eratosthenes.
CSE1301 Computer Programming: Lecture 33 Linked Lists.
Binary Search Visualization i j.
General Computer Science for Engineers CISC 106 Lecture 19 Dr. John Cavazos Computer and Information Sciences 04/06/2009.
Презентація за розділом “Гумористичні твори”
Центр атестації педагогічних працівників 2014
Галактики і квазари.
Характеристика ІНДІЇ.
Процюк Н.В. вчитель початкових класів Боярської ЗОШ І – ІІІ ст №4
Tutorial 9 String and Structure NUS SCHOOL OF COMPUTING CS1010E PROGRAMMING METHODOLOGY 1 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO.
1.7 Arrays academy.zariba.com 1. Lecture Content 1.Basic Operations with Arrays 2.Console Input & Output of Arrays 3.Iterating Over Arrays 4.List 5.Cloning.
Multiplication Facts 1-25
CS1010E Programming Methodology Tutorial 3 Control Structures and Data Files C14,A15,D11,C08,C11,A02.
Copyright © 2011 Pearson, Inc. 9.2 The Binomial Theorem.
computer
WEEK 4 Class Activities Lecturer’s slides.
Topic 25 - more array algorithms 1 "To excel in Java, or any computer language, you want to build skill in both the "large" and "small". By "large" I mean.
Sieve of Eratosthenes. The Sieve of Eratosthenes is a method that.
Python Arrays. An array is a variable that stores a collection of things, like a list. For example a list of peoples names. We can access the different.
Духовні символи Голосіївського району
Pascal Programming Arrays and String Type.
Area & Perimeter BINGO Area = l x w Perimeter = S + S + S + S.
Ranges. Unlike many of our programming concepts, the idea of a Range is particular to Excel The ideas and code discussed in these slides can be found.
Tutorial 2 Control Flow: Loops NUS SCHOOL OF COMPUTING CS1010E PROGRAMMING METHODOLOGY 1 CS1010E TUTORIAL SLIDES PREPARED BY WU CHAO.
2.6 APPLICATIONS OF INDUCTION & OTHER IDEAS IMPORTANT THEOREMS MIDWESTERN STATE UNIVERSITY – COMPUTER SCIENCE.
© T Madas What comes next and what is the name of these sequences?
Prime Numbers Lecture L4.4 Sieve of Eratosthenes.
CSE 1301 Lecture 12 Arrays Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
EVEN NUMBERS EVEN NUMBERS 1 = prime 2 = prime1 3 = prime 4 = 2 x 22 5 = prime 6 = 2 x 33 7 = prime 8 = 2 x 2 x 24 9 = 3 x 3 10 = 2 x 55.
ECE 1304 Introduction to Electrical and Computer Engineering
Tutorial 8 Pointers and Strings
continued on next slide
Using The Sieve of Eratosthenes
NUR 590 Education on your terms/tutorialrank.com.
NUR 590 Become Exceptional/ newtonhelp.com. NUR 590 Week 1 Individual Assignment Practicum Project Power Point Presentation For more course tutorials.
                                                                                                                                                                                                                                                
continued on next slide
continued on next slide
Проф. д-р Васил Цанов, Институт за икономически изследвания при БАН
ЗУТ ПРОЕКТ на Закон за изменение и допълнение на ЗУТ
О Б Щ И Н А С И Л И С Т Р А П р о е к т Б ю д ж е т г.
Електронни услуги на НАП
Боряна Георгиева – директор на
РАЙОНЕН СЪД - БУРГАС РАБОТНА СРЕЩА СЪС СЪДЕБНИТЕ ЗАСЕДАТЕЛИ ПРИ РАЙОНЕН СЪД – БУРГАС 21 ОКТОМВРИ 2016 г.
Сътрудничество между полицията и другите специалисти в България
Съобщение Ръководството на НУ “Христо Ботев“ – гр. Елин Пелин
НАЦИОНАЛНА АГЕНЦИЯ ЗА ПРИХОДИТЕ
ДОБРОВОЛЕН РЕЗЕРВ НА ВЪОРЪЖЕНИТЕ СИЛИ НА РЕПУБЛИКА БЪЛГАРИЯ
Съвременни софтуерни решения
ПО ПЧЕЛАРСТВО ЗА ТРИГОДИШНИЯ
от проучване на общественото мнение,
Васил Големански Ноември, 2006
Програма за развитие на селските райони
ОПЕРАТИВНА ПРОГРАМА “АДМИНИСТРАТИВЕН КАПАЦИТЕТ”
БАЛИСТИКА НА ТЯЛО ПРИ СВОБОДНО ПАДАНЕ В ЗЕМНАТА АТМОСФЕРА
МЕДИЦИНСКИ УНИВЕРСИТЕТ – ПЛЕВЕН
Стратегия за развитие на клъстера 2015
Моето наследствено призвание
Правна кантора “Джингов, Гугински, Кючуков & Величков”
Безопасност на движението
DISCRETE COMPUTATIONAL STRUCTURES
© T Madas.
Tutorial 6 Array Problem Solving
continued on next slide
continued on next slide
Presentation transcript:

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