Hello, people=)
Who knows how to implement avl-tree in Qt? Maybe there are some examples? Nobody is trying to implement this class?
Thank all for attention!
Sorry for my English=)
Hello, people=)
Who knows how to implement avl-tree in Qt? Maybe there are some examples? Nobody is trying to implement this class?
Thank all for attention!
Sorry for my English=)
Last edited by wysota; 29th May 2011 at 21:27.
Looks like there a C++ Implementation http://standardavl.sourceforge.net/
This implementation has many errors and doesn't work=(
Help me fix, please
Point.h
Point.cpp
AvlTree.h
main.cpp
and "AvlTree.cpp" (can't load)
http://sourceforge.net/projects/stan...e.cpp/download
vs2008
1>c:\users\...\avltree.h(19) : error C2143: syntax error : missing ',' before '<'
1>c:\users\...\point.h(110) : error C3861: 'round': identifier not found
1>c:\users\...\avltree.h(90) : error C2065: 'less' : undeclared identifier
1>c:\users\...\avltree.h(90) : error C2974: 'AvlTree' : invalid template argument for 'Compare', type expected
1>c:\users\...\main.cpp(8) : error C2143: syntax error : missing ';' before '>'
1>c:\users\...\main.cpp(8) : error C2143: syntax error : missing ';' before '>'
1>c:\users\...\main.cpp(12) : error C2065: 't' : undeclared identifier
1>c:\users\...\main.cpp(12) : error C2228: left of '.printTree' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\...\main.cpp(37) : error C2065: 't' : undeclared identifier
1>c:\users\...\main.cpp(37) : error C2228: left of '.insert' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\...\main.cpp(51) : error C2065: 't' : undeclared identifier
1>c:\users\...\main.cpp(51) : error C2228: left of '.printTree' must have class/struct/union
1> type is ''unknown-type''
1>c:\users\...\main.cpp(64) : error C2065: 't' : undeclared identifier
1>c:\users\...\main.cpp(64) : error C2228: left of '.rangeQuery' must have class/struct/union
I've never seen library <float.h> and I do not know how to use it
It seems to work fine for me. float.h is a standard header file, at least for gcc.
Qt Code:
#include "AvlTree.h" #include <iostream> int main(int argc, char **argv){ AvlTree<int> tree; tree.insert(1); tree.insert(2); tree.insert(3); std::cout << tree.height() << std::endl; // prints "2" return 0; }To copy to clipboard, switch view to plain text mode
Bookmarks