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 Spring 2004: Data structures

Link back to Sp2004 Final Exam Review

Questions and Answers?



Karin Bowman

An array isn't a pattern. A directory structure is only one kind of tree. That definition of lists needs to be broader. Hash tables aren't necessarily about databases – that's just one use we put to them. Mark Guzdial


Is an array a collection of numbers in a specific sequence? In addition to what's mentioned above, lists can use methods such as sort() that strings cannot use.

An array doesn't have to contain numbers, but whatever things it does contain are numbered – i.e. referred to by number. (Is that what you mean by being 'in a specific sequence'?) Colin Potts

I know how to write examples to execute in the command area for trees, lists, and hash tables, but what about arrays and matrices? A little direction, please...

Hint: Sound samples are stored in arrays, and pixels are stored in matrices. Mark Guzdial


so then arrays are one-dimensional and matrices are two-dimensional?

Tres bien! Mark Guzdial


Do all these examples look ok?
For an Array:
samples = getSamples(sound)
print samples

For a Matrix:
pixel = getPixel(picture, 10,10)
print pixel

For a Tree:
filename= PickAFile()
print filename

For a List:
mylist = ["My", "name", "is", "Heather"]
print mylist

For a Hash table:
row = 'StudentName': 'Katie', 'StudentID': 'S1'
print row ['StudentName']

Heather Symon

For the array, could you show accessing an array element? Mark Guzdial


Mark, is this the tree you are looking for?
A tree is a hierarchical structure of files, functions or other kind of data into sub categories from the main/root element/function/directory.
Anu

lists: elements of any form, i.e, strings or numbers or pictures or sounds, are stored in sequence but not necessrily stored one after the other in the computer's memory. eg: ["alan",2,sound.wav,pic.jpg]

hash tables: to make rows of data in python by having indices of strings in an array.
array eg:
>>>hello="hello"
>>>print hello[2:4]
ll
ANu

Anu, your definition of tree is reasonable, and lists, too, but I don't get your definition of hash tables. Mark Guzdial


for an array:
>>>samples = getSamples(sound)
>>>print samples

is this correct??

print getSampleValueAt(sound,1)



Link to this Page