View Full Version : AVL-tree
FORever_YOUng
29th May 2011, 22:02
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=)
wysota
29th May 2011, 22:27
AVL in Qt doesn't differ from AVL in C++.
Santosh Reddy
29th May 2011, 22:28
Looks like there a C++ Implementation http://standardavl.sourceforge.net/
FORever_YOUng
30th May 2011, 09:33
Looks like there a C++ Implementation http://standardavl.sourceforge.net/
This implementation has many errors and doesn't work=(
Help me fix, please
6493
6494
6495
6496
and "AvlTree.cpp" (can't load)
http://sourceforge.net/projects/standardavl/files/standardavl/0.1/AvlTree.cpp/download
wysota
30th May 2011, 09:35
What errors, what doesn't work?
FORever_YOUng
30th May 2011, 12:47
What errors, what doesn't work?
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
wysota
30th May 2011, 13:03
It seems to work fine for me. float.h is a standard header file, at least for gcc.
#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;
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.