Chapter7 - Elementary Data Structures Chapter 7 1...

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

View Full Document Right Arrow Icon
1 Elementary Data Structures Chapter 7
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Introduction Some programs need to store and process large amounts of data These programs require more complicated algorithms and will need to handle the data in an efficient manner Therefore, a programmer will need to utilize data structures
Background image of page 2
3 What is a Data Structure? A data structure is a software tool designed to store lots of data Two kinds of data structures: Graphical: Listview, Listbox, combo box, etc. Non-Graphical: Stack, Array, Array List, Queue, etc.
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Indexed Data Structures What is an indexed data structure ? Ordered lists There are row indices with data in each row This makes it very easy to locate and access data Examples: Listbox, Array, ArrayList, etc.
Background image of page 4
5 What We Will Be Studying Array and ArrayList They are indexed data structures They are non-graphical They are objects Sample Programs Optics.vb WarSim.vb Arraylist Array
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 ArrayList Data Structure It is a data structure designed to store large amounts of data It is an ordered list, whose elements (rows) can be accessed with a row index It is a dynamic data structure Its size changes in run-time as items are added or removed Each arraylist is an object
Background image of page 6
7 Why use ArrayLists? Keeps data off the GUI, hidden from the user Example: List of usernames and passwords Avoid clutter on the form There may be limited room on the form
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 Optics.vb This program calculates the height and location of the image created, when an object is placed in front of a mirror Each mirror has three characteristics: name, radius, and type
Background image of page 8
9 Spherical Mirrors When an object is placed in front of a mirror, an image of that object is formed Concave mirrors form an image in front of the mirror (real image) Convex mirrors form an image behind the mirror (virtual image) Concave Mirror Convex Mirror
Background image of page 9

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

View Full DocumentRight Arrow Icon
10 Spherical Mirrors (cont.) Image Distance Equation, where f is the focal point of the mirror Image Height Equation: ance ObjectDist 1 1 1 nce ImageDista - = f - = convex radius concave radius f 2 1 2 1 ImageHeight = - ( ObjectHeight )( ImageDistance ) ObjectDistance
Background image of page 10
11 Are Data Structures Needed? Mirror data is not built into the program Mirrors are defined by the user in run-time; the database may contain only one mirror or 100 mirrors. We cannot use variables, because We do not know how many variables to declare We may have to use a large number of variables We cannot cycle through the database with a single loop A data structure is needed!
Background image of page 11

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

View Full DocumentRight Arrow Icon
12 Data Structures in Optics.vb What type of Data Structure? We will use both arraylists and listboxes
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 96

Chapter7 - Elementary Data Structures Chapter 7 1...

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

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