CSC 115.005/006 Sonoma State University Spring 2022
Scribbler 2
CSC 115.005/006:
Programming I
Scribbler 2
Instructor: Henry M. Walker

Lecturer, Sonoma State University
Professor Emeritus of Computer Science and Mathematics, Grinnell College


Course Home References Course Details: Syllabus, Schedule, Deadlines, Topic organization MyroC Documentation Project Scope/
Acknowledgments

Notes:

Grouping Data and Image Processing with the Scribbler 2: An Overview

So far in this course, variables have identified individual pieces of data (e.g., an int, float, double, char) or arrays of these individual data elements. Although these variables have been quite useful, many applications require groupings of different types of data. Several examples follow.

This module explores two basic ways of grouping data, beyond the 1-dimensional array we have already encountered.

Beyond these basic approaches, arrays and structs can be combined in flexible ways. For example, the red, green, and blue components of a pixel can be combined into a struct. Then a grid of pixels can be represented by a 2-dimensional array. Finally, a picture can be defined as a struct specifying a height, a width, and the 2-dimensional array of pixels.

Beyond these basic approaches for storage, many applications require data to be ordered (e.g., alphabetically by last name in the Registrar's Office or in decreasing light intensity in a picture).

This module explores the grouping of data, providing considerable experience with structs, 2-dimensional arrays, and even 1-dimensional arrays of structs. The module also introduces a relatively simple algorithm, called an insertion sort, for sorting arrays of data.

Later computing courses likely will investigate additional mechanisms for structuring and ordering data, building upon the basic ideas introduced here.



created 10 April 2016 by Henry M. Walker
revised 10 August 2016 by Henry M. Walker
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.