@@ -33,7 +33,7 @@ static PyObject* BinaryTree___new__(PyTypeObject* type, PyObject *args, PyObject
33
33
PyObject *key = PyObject_GetItem (args, PyZero);
34
34
PyObject *root_data = PyObject_GetItem (args, PyOne);
35
35
PyObject *comp = PyObject_GetItem (args, PyTwo);
36
- PyObject *is_order_statistic = PyObject_GetItem (args, PyThree);
36
+ PyObject *is_ordered_statistic = PyObject_GetItem (args, PyThree);
37
37
if ( (key == Py_None) && (root_data != Py_None) ) {
38
38
PyErr_SetString (PyExc_ValueError, " Key required." );
39
39
return NULL ;
@@ -42,7 +42,7 @@ static PyObject* BinaryTree___new__(PyTypeObject* type, PyObject *args, PyObject
42
42
Py_INCREF (Py_None);
43
43
key = root_data == Py_None ? Py_None : key; // This key is the argument, not self->key
44
44
45
- PyObject* root = TreeNode___new__ (key, root_data); // check if this is correct
45
+ PyObject* root = TreeNode___new__ (&TreeNodeType, key, root_data); // check if this is correct
46
46
root->is_root = true ;
47
47
48
48
self->root_idx = 0 ;
@@ -53,12 +53,12 @@ static PyObject* BinaryTree___new__(PyTypeObject* type, PyObject *args, PyObject
53
53
self->size = 1 ;
54
54
55
55
if (comp == Py_None){
56
- self->comparator = PyObject_RichCompare (PyObject *key1, PyObject *key2, Py_LT);
56
+ self->comparator = PyObject_RichCompare (PyObject *key1, PyObject *key2, Py_LT); // lambda functions, check how to do this
57
57
}
58
58
else {
59
59
self->comparator = comp;
60
60
}
61
- self->is_order_statistic = is_order_statistic ;
61
+ self->is_ordered_statistic = is_ordered_statistic ;
62
62
63
63
return reinterpret_cast <PyObject*>(self);
64
64
}
@@ -82,7 +82,7 @@ static PyObject* BinaryTree___str__(BinaryTree *self) {
82
82
long size = self->tree ->_last_pos_filled +1 ;
83
83
PyObject* list = PyList_New (size);
84
84
for (int i=0 ;i<size;i++){
85
- PyObject * node = self->tree ->_one_dimensional_array ->_data [i]; // check this
85
+ TreeNode * node = self->tree ->_one_dimensional_array ->_data [i]; // check this
86
86
if (node != Py_None){
87
87
PyObject* out = Py_BuildValue (" (OllO)" , node->left , node->key , node->data , node->right );
88
88
Py_INCREF (out);
0 commit comments