martes, julio 15, 2008

Binary Search Tree --- damn it!!

PROBLEM FIXED!!

The problem was at line 68 @ bst.c, self_node was a pointer to a pointer structure, so to make a bifurcation it's necessary to use the * operator, but I had self_node without the * operator. But now the problem is fixed, and I can continue programming more functionts to the tree.

----------

Hi people,

In the "Data Structure" class, I had to build a Binary Search Tree with some functions related, so I tried to make the program in ANSI C with some OOP emulation (something of "Object-Oriented with ANSI C" by Axel-Tobias Schreiner), but I got a little trouble, the _insertItem() function doesn't work (line 67~74 @ bst.c file). Really, I have no idea what is going on in those lines, they are supposed to work, but they aren't.

So people I need your help, because I don't know how fix it. :(

here is the URL:

http://crosvera.0fees.net/codes/damn_tree.tar.bz2

Thanks!


PS: If you found that my english sucks tell me! I need to improve it. :D

--
Change Log:

Update 1: I changed the bst.c file, but it still have problem, now it has a segfault. lol :P
Update 2: Fixed!, thanks to XBREAK and specially to tezeract.

2 comentarios:

Awef dijo...

Have you tried using gnu debugger (gdb) ?

i.e: gdb program
r <- runs the program
-- then make the program crash
bt <- dumps the stack with the backtrace

javier nomas dijo...

2do comentario sobre inglés :P. Tampoco tienes cosas completamente malas, pero si veo que estás traduciendo más que pensando en inglés.

The problem was at line...
was a pointer to a
Esto es más una cosa de redacción que de inglés, yo habría dicho, but finally the problem...
Y ese really sin coma, va en otra parte, I have really no idea ....
Fijate al final, que pusiste aren't en contraposición de algo que si está funcionando, pero no lo escribiste. O sea, they are supposed to work, but they aren't.
Y finalmente en el primer update, te faltó el sujeto, but it o i still have problems.

No se si ya lo has hecho, pero podrías acercarte a los profes de inglés de la ubb, son super buena gente para responder preguntas.

Saludos