We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 75ce399 commit f770a00Copy full SHA for f770a00
unit6/.pro4.py.swp
12 KB
unit6/pro4.py
@@ -0,0 +1,21 @@
1
+from opus7.tree import Tree
2
+
3
+class treeCompare(Tree):
4
5
+ def _compareTo(self, obj):
6
+ assert isInstance(self, obj.__class__)
7
+ if self.isEmpty:
8
+ if obj.isEmpty:
9
+ return 0
10
+ else:
11
+ return -1
12
+ elif obj.isEmpty:
13
+ return 1
14
15
+ result = cmp(self._key, obj._key)
16
+ i = 0
17
+ while result == 0 and i < self.degree:
18
+ result = cmp(self.getSubtree(i), obj.getSubtree(i))
19
+ i += 1
20
+ return result
21
0 commit comments