{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture 19-More Array Algorithms

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

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

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

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

View Full Document
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 [3][4]; 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
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

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

View Full Document
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. */
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern