From 6f25d074c33e48da001ed315e327847737cb7772 Mon Sep 17 00:00:00 2001 From: wesleywu20 Date: Wed, 11 Mar 2020 14:52:13 -0500 Subject: [PATCH] fixed issue #32 corrected the remove function to handle the case where the user inputs a value that is not in the list into the function --- .DS_Store | Bin 0 -> 8196 bytes _sources/.DS_Store | Bin 0 -> 8196 bytes ...ImplementinganUnorderedListLinkedLists.rst | 87 +++++++++--------- build_info | 1 + 4 files changed, 46 insertions(+), 42 deletions(-) create mode 100644 .DS_Store create mode 100644 _sources/.DS_Store create mode 100644 build_info diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..62f895ec6bb074336482daa162f39413fd8e618b GIT binary patch literal 8196 zcmeHM&2G~`5T5N1by5`~sMH*N;nqg2psgx|6w(x_5+Fnn8~~+uV^V`_huCRaLQpvH z5OCnmqwoYg2oC_?>~2f!BydBh-HmoLkian$jR(5Ew;(WA}MP>vd|;Nh*G??*`Gn8$>QN_)B#Q zx%5*e)c8uEPBBH)p*HM1iZl9O|EBMDQBwGm*BYV9zH!Y2CI?iwyh0(`b{QQ`ph1mLylF8OE!j8sC)F(qj@ z#S$!s;h!ZJ(6db=qxk`vD?^UT|JH=ddOyK_P50pDCf3!)>N4w+ zwD>YK+Z@Oc$vH|)sq{R=q!`wo$Jo1=Ylj|C4dvv$r>$B*?g%S8L=J)1n7PEq%v?FF zrvoekU=Yhosw{Gh!tgv}EY2%w$80r2+dMsjgYHn3?n_5aAcMF(M1}$=x!MLPR6o>oq2Jb^H9{U65RbISv15;;l}PbGSV60}XzmA`bU zalj9g3t2X_yzXGcYOc= literal 0 HcmV?d00001 diff --git a/_sources/.DS_Store b/_sources/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e27541ba0de87de0fed1493fbcba6eae1b3ebb6e GIT binary patch literal 8196 zcmeHM-EJF26h4!t_1bOlrcFpFLb9-sDm6lh=#MH?)pZgTi=UX-3JGm-*Y?C&bveuSOu&CRspMkRp9@i z0G`>ZIL~?Rn_1gh1*`(Eqyp-ED4;4VB{(psj}A2Y3ILqMurBDU>ww}E5-cS+Fo+ox zW~e|zWyuwT89K%biCrndfk8tjmRvqqvNB6W=r|B*Q@GB{Vbxb>0=Pn7b1KOtu zW6Ar1p$9gX@{osZq%Aw(b@7Hlz)wW)!Xx51zCQap#m-P!^ARbnP%UNs*MD0#_o7}i z(2@Pp>;--lFE0MdCeBQrJ(qEuoRgc%J*@4>y;|(W{iy7P_tmGW7wo#=*q!yM1f8 znnBhEroP+VS||c3I+#(cb94`B<53TZm`XgI=--YddKSqksEvesa(c2MYNBz*1*+)e z43X|_>LcaU5g|#W(oUuLI4?sVfw@ep^a<5yHD#?*dfa-7s@Q|X9yo9r2Z=c#Mz0=6 zM~O=Bab}j*!D%5fb#$B(nbLqcV;bZTk2<f4rtpZko7oY%}T&b;;vC!~$MS4wj*DjzwLRCfC s4Gd}u8hsrH>gzag^bbSy3ouojQi2167(sdQF9PiIUkh)WS6YF80YRategFUf literal 0 HcmV?d00001 diff --git a/_sources/BasicDS/ImplementinganUnorderedListLinkedLists.rst b/_sources/BasicDS/ImplementinganUnorderedListLinkedLists.rst index ac2001c1..d8a14a6e 100644 --- a/_sources/BasicDS/ImplementinganUnorderedListLinkedLists.rst +++ b/_sources/BasicDS/ImplementinganUnorderedListLinkedLists.rst @@ -564,20 +564,21 @@ You can try out the ``UnorderedList`` class in ActiveCode 1. return found def remove(self,item): - current = self.head - previous = None - found = False - while not found: - if current.getData() == item: - found = True - else: - previous = current - current = current.getNext() - - if previous == None: - self.head = current.getNext() - else: - previous.setNext(current.getNext()) + current = self.head + previous = None + found = False + while current and not found: + if current.getData() == item: + found = True + else: + previous = current + current = current.getNext() + + if found: + if previous == None: + self.head = current.getNext() + else: + previous.setNext(current.getNext()) mylist = UnorderedList() @@ -670,20 +671,21 @@ starting with 0. return found def remove(self,item): - current = self.head - previous = None - found = False - while not found: - if current.getData() == item: - found = True - else: - previous = current - current = current.getNext() - - if previous == None: - self.head = current.getNext() - else: - previous.setNext(current.getNext()) + current = self.head + previous = None + found = False + while current and not found: + if current.getData() == item: + found = True + else: + previous = current + current = current.getNext() + + if found: + if previous == None: + self.head = current.getNext() + else: + previous.setNext(current.getNext()) mylist = UnorderedList() @@ -746,20 +748,21 @@ starting with 0. return found def remove(self,item): - current = self.head - previous = None - found = False - while not found: - if current.getData() == item: - found = True - else: - previous = current - current = current.getNext() - - if previous == None: - self.head = current.getNext() - else: - previous.setNext(current.getNext()) + current = self.head + previous = None + found = False + while current and not found: + if current.getData() == item: + found = True + else: + previous = current + current = current.getNext() + + if found: + if previous == None: + self.head = current.getNext() + else: + previous.setNext(current.getNext()) mylist = UnorderedList() diff --git a/build_info b/build_info new file mode 100644 index 00000000..75ce12c1 --- /dev/null +++ b/build_info @@ -0,0 +1 @@ +4.0.0-37-g52f53e0