DataStructures1Notes

DataStructures1Notes - In this lecture we will begin...

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

View Full Document Right Arrow Icon
In this lecture we will begin exploring how data is actually organized (i.e. structured) to be stored, accessed, and processed on the computer. 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
The data structure has great influence on the performance of data processing. The data structures used for a particular data processing application have to let the application easily (i.e. quickly) retrieve the data currently being processed, as well as all the related data needed for the processing. For example in the case of blurring a digital image, the application needs to have easy access to the current pixel as well as to the neighbors of the current pixel. The data structures to be used for a particular data processing application have to be designed in conjunction with the actual data processing step-by-step instructions, or algorithm. 2
Background image of page 2
In this lecture we will look at regular, uniform data structures called arrays. Arrays are used very frequently in data processing. An array is a regularly arranged collection of identical data elements. Each data element takes up the same amount of (memory) space. There is no space between adjacent elements. This allows direct access to any element in the array through indexing. Arrays have implicit structure. In other words there is no special data to encode the structure. All memory used by the array goes towards storing the payload, i.e. the data that one wants to process. 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
The simplest array is one dimensional. Think of a 1-D array as of a row of elements. 4
Background image of page 4
The houses on one side of a street can be thought of as an 1-D array. 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
6
Background image of page 6
Another example: the temperatures recorded every hour at a given location. An element is a number: the temperature at that hour. The index of the array corresponds to time (a 1-hour digitization of continuous time). There are 24 elements since there are 24 hours in a day. 7
Background image of page 7

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

View Full DocumentRight Arrow Icon
Indices are shown in this and other diagrams for explanation purposes, but they are not actually stored in the array. 8
Background image of page 8
Assuming the array is called T and that the first element corresponds to midnight, the temperature at 8am is found as T[8] and it is 60 degrees. Note that we use 0-based indices. This means that the k-th element in the array has index k-1. The first index is 0, and the last index is n-1, if the array has n elements. 9
Background image of page 9

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

View Full DocumentRight Arrow Icon
For those of you familiar with the 24-h format of time, you’ll know right away that 7pm is 19:00. Let’s say we want to change the temperature for 7pm. That means we need to assign
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/27/2012 for the course CS 177 taught by Professor Staff during the Spring '08 term at Purdue University.

Page1 / 38

DataStructures1Notes - In this lecture we will begin...

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

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