0% found this document useful (0 votes)
4 views

dsaa60

Uploaded by

farawayfromhere
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

dsaa60

Uploaded by

farawayfromhere
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

2.

3 Accessing Elements in a Python List 45

33 <DataPoint x="17645" y="31.0"/>


34 <DataPoint x="18658" y="38.0"/>
35 <DataPoint x="20266" y="40.0"/>
36 <DataPoint x="21854" y="31.0"/>
37 ...
38 <DataPoint x="197159" y="37.0"/>
39 <DataPoint x="199601" y="40.0"/>
40 </Sequence>
41 </Plot>
Listing 2.2 A Plot XML Sample

Since we’ll be taking a look at quite a bit of experimental data in this text, we
have written a tkinter program that will read an XML file with the format given in
Listing 2.2 and plot the sequences to the screen. The PlotData.py program is given
in Sect. 22.4.
If we use the program to plot the data gathered by the list access experiment, we
see a graph like the one in Fig. 2.2. This graph provides the experimental data to back
up the two statements we made earlier about lists in Python. The red line shows the
average element access time of 1000 element accesses on a list of the given size. The
average access time (computed from a sample of 1000 random list accesses) is no
longer on a list of 10,000 than it is on a list of 160,000. While the exact values are not

Fig. 2.2 Access times in a Python list

You might also like