Lecture 19-More Array Algorithms

Lecture 19-More Array Algorithms - CS1110 4 November 2010...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
CS1110 4 November 2010 Developing array algorithms. Reading: 8.3. .8.5 1 Prelim Tuesday, 7:30PM. Olin 155 and 255 Review session, Sunday 1–3. Phillips 101 Handout describes what will be covered. have iclickers ready for quiz
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Type of d is int [][] (“ int array array”, “an array of int arrays”) To declare variable d: int d[][]. To create a new array and assign it to d: d= new int To reference element at row r column c: d[r][c] number of rows number of cols Two-dimensional arrays 5 4 7 3 b 0 1 2 3 b.length one-dimensional array d 5 4 7 3 4 8 9 7 5 1 2 3 0 1 2 3 0 1 2 rectangular array: 5 rows and 4 columns 2
Background image of page 2
3 A 2-dimensional array b Same array in row-major order: c P00 P01 P02 P03 P10 P11 P12 P13 P20 P21 P22 P23 You can see that b[0][j] is same as c[0 * (no of columns) + j] b[1][j] is same as c[1 * (no of columns) + j] and in general: b[i][j] is same as c[i * (no of columns) + j] P00 P01 P02 P03 P10 P11 P12 P13 P20 P21 P22 P23
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Pixel (picture element): 4 components, each in 0. .255 4 Contains: alpha component (we never change it) red component r green component g blue component b /** DM provides functions for extracting components of a pixel. */
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

Lecture 19-More Array Algorithms - CS1110 4 November 2010...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online