Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Final Exam Review Fall 2003: Data structures

Questions, comments, answers?

Back to Fall2003 Final Exam Review



Array:
A sequence of bytes right next to one another in memory. We call each value in an array an element. So an array is a sequence of elements!
ex:
Array = [5]
(This makes an empty array of 5 elements.)

Matrix:
A 2D array. Think of it like a horizontal array that has a vertical array for each of its elements. Each vertical array then holds whatever you want, but it looks like a 2D grid when you visualize it.
ex:
Matrix = [[1,5,7],[5,6,7],[3,8,4]]
(This makes a 3x3 matrix holding numbers)

Tree:
A structure, like files and folders, where elements can hold other elements, which can hold more elements, and so on. (like branches/leaves)
You can also think of it as a list that, for its elements, has all different sized lists which in turn hold more different sized lists and so on.
ex:
PickAFile()
(This searches through files and folders.. through a tree)

List:
A one-dimensional array.
ex:
List = [1,2,3,4,5]
(this makes a list of 5 numbers.)

Hash Table:
An array that, instead of numbers for the indexes, uses strings. So if mystuff was a one dementional hash table, you could say:
mystuff[“jacket”] or mystuff[“computer”] to access the data associated with the strings “jacket” and “computer”.
ex:
Hash = {‘name’:’bob’,’id’:’5465’}
So now
Hash[‘name’] gives ‘bob’
And
Hash[‘id’] gives ‘5465’







The definition for List is wrong, and the example for Array is wrong. Mark Guzdial


array = [5] makes an array with one element the integer 5

No, it doesn't. That makes a list with one element, not an array. Mark Guzdial


Range creates an array. So how about anArray=range(1,10).

anyone know the answer to list and array????

Range actually creates a sequence. Arrays and lists are both sequences. Sounds and strings are the only arrays we've used in this class. Mark Guzdial


ok what is the difference between a list and an array. !!

1) An array assigns an index number to an integer, string, or object and stores each one right after the other in the computer’s memory so it is easily accessed.
getSampleValueAt(sound,2)
2) A matrix assigns an element to an x,y position like a 2D array or grid.
pixel = getPixel(pic,1,1)
3) A tree is a data structure where a root element holds other branching elements, like files on your computer.
file = pickAFile()
4) A list is similar to an array except it does not store each element one after the other in the computer’s memory.
list = [5]
5) A hash table is an array with strings for indices rather than numbers.
row={'StudentName':'Katie','StudentID':'S1'}

how does that look

An array consists of consecutive mailboxes in memory and just holds simple values like samples or characters. A list is a more sophisticated data structure that can contain all kinds of things including samples, characters, pixels (remember that pixels actually have THREE values in each one), and even sublists. For example, lists can represent hierarchical data structures like trees, while arrays cannot (easily). Mark Guzdial

is the above example for an array right?

Sure, I agree that that's an example of accessing an array. Mark Guzdial


array=music
matrix=pictures
Nope. Array is the data structure for a SOUND (not music). Pictures are represented as a matrix of pixels. Mark Guzdial

• Array – a sequence of elements that are stored one after another in the computer’s memory – the indices of the sample values in a sound.
• Matrix – each element in an object has x and y location and one and only one element exist at each intersection point of x and y – pixels in a picture
AKA a 2-D array. Mark Guzdial
• Tree – breaks down a big system of lot of elements into smaller elements until an executable element exist – C: broken into folders, folders broken into files.
Exectuable? Think "hierarchy." Mark Guzdial
• List – elements of any form, i.e. strings or numbers or pictures or sounds, are stored in sequence but not necessarily stored one after the other in the computer’s memory – [“Mark”, 2, sound.wav, picture.jpg]
VERY nice! Mark Guzdial
• Hash Table – to make rows of data in python by having indices of strings in an array. Row = {“StudentName”: “Katie”, “StudentID” : “S1”}

DITTO! Very nice! Mark Guzdial

Pls. correct me if I am wrong.

hjhjhj

hjhjhj

hjhjhj

bhjkmjkjh

bhjkmjkjh

bhjkmjkjh

bhjkmjkjh

bhjkmjkjh

bhjkmjkjh



Link to this Page