FIT1045 Lecture Notes - Lecture 3: Adjacency List

55 views3 pages
Lists
list = ['Milk','Eggs']
Suppose we have 2 lists, a and b
len(a) !"#$%&'()*("+,&(a
a +b!-)$-.&#$.&+$%(/+**("+,&,
n*a!-)$-.&#$.&+$%("+,&($(&+0#,
a[k] = x !(( 1#2".-+$% .$(#"#0(3(+$/#4(5(6+&'(4
x in a!&17#(+*(4(+,(.$(+&#0()*(a
x not in a!&17#(+*(4(+,$8&(.$(+&#0()*((a
a.append(x) !(( .//(+&#0(4(&)(&'#(#$/()*("+,&(a
a.count(x) !(( %+9#,($):()*(&+0#,(+&#0(4(.22#.1,(+$(a
a.index(x) !(( 1#&71$,(*+1,&(2),+&+)$()*(+&#0(4(+$(a
a.pop() !((%+9#,(".,&(+&#0(.$/(1#0)9#,
a.remove(x) !(( 1#0)9#,(*+1,&()--711#$-#( )*(4(+$(a
a.reverse() !(( 1#9#1,#(.""(+&#0,
b = a[:] !(( -1#.&#,(-)2;()*("+,&(.$/(.,,+%$,(&)(<
=.$(.",)(7,#(import copy
>>>(y = copy.copy(x)
?$/#4#,@(,&.1&(*1)0(A(BC9#DE()1(!F(B1#9#1,#D
=.$(+$-"7/#($70<#1,(.,(6#""(.,(,&1+$%,
Mutable G(#"#0#$&,(-.$(<#(."&#1#/()$#(<;()$#(+$()1+%+$."(
+&,#"*:
H,+$%(+$/#4(&)(.--#,,(+&#0,()$#(<;()$#
?&#1.&+$%()9#1("+,&,
n = len(shoppingList)
for i in range(n):
print(shoppingList[i])
Tables
I#-'$+-."";("+,&,(+$("+,&,:
JJ.--)1/+$%(&)(1)6K
table = [['Coles','milk','eggs'],
['K-mart','shirt']]
table.append(x) !((.//("+,&(4(&)(&'#(#$/()*(
&.<"#(a
Graphs
L#1&#4M(N))2M(O/%#
P+1#-&#/Q(R+02"#Q(=)$$#-&#/Q(S#+%'&#/Q(N.<#""#/Q
T/U.-#$-;("+,&
G(.(&.<"#(6'#1#(#.-'(+$$#1("+,&(')"/,(&'#(9#1&+-#,(&'.&(.1#(
./U.-#$&(&)(.(%+9#$(9#1&#4:(V)10."";(/)$#(7,+$%(&'#(+$/#4()*(
&'#(9#1&#4:
O/%#W9#1&#4("+,&
G(.(&.<"#(6'#1#(#.-'(+$$#1("+,&(1#21#,#$&,(.$(#/%#
X+1,&(#"#0#$&()*(#/%#W"+,&(+,(,&.1&(9#1&#4E(&'#$(#$/(9#1&#4
L#1&+-#,(7,7."";(+/#$&+*+#/(<;(+$/#4
?*(%1.2'(6#+%'&#/E(6#+%'&(-)7"/(<#(Y1/(#"#0()*(+$$#1("+,&
Week$3:$Data$Structures
Z)$/.;E([(T7%7,&(\AF[
F\@A]
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents