Results 1 to 7 of 7

Thread: AVL-tree

  1. #1
    Join Date
    May 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question AVL-tree

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: AVL-tree

    AVL in Qt doesn't differ from AVL in C++.
    Last edited by wysota; 29th May 2011 at 22:07.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: AVL-tree

    Looks like there a C++ Implementation http://standardavl.sourceforge.net/

  4. #4
    Join Date
    May 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: AVL-tree

    Quote Originally Posted by Santosh Reddy View Post
    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

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: AVL-tree

    What errors, what doesn't work?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    May 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: AVL-tree

    Quote Originally Posted by wysota View Post
    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

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: AVL-tree

    It seems to work fine for me. float.h is a standard header file, at least for gcc.

    Qt Code:
    1. #include "AvlTree.h"
    2. #include <iostream>
    3.  
    4. int main(int argc, char **argv){
    5. AvlTree<int> tree;
    6. tree.insert(1);
    7. tree.insert(2);
    8. tree.insert(3);
    9. std::cout << tree.height() << std::endl; // prints "2"
    10. return 0;
    11. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How to Draw a tree by using QT?
    By NewLegend in forum Qt Programming
    Replies: 16
    Last Post: 26th November 2010, 19:29
  2. tree widget like designer's widget tree
    By nroberts in forum Newbie
    Replies: 1
    Last Post: 20th November 2010, 00:06
  3. Tree structure
    By ikm in forum Newbie
    Replies: 1
    Last Post: 7th August 2009, 20:19
  4. QAbstractProxyModel to do a Tree
    By xgoan in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2008, 17:31
  5. What if QT tree is moved?
    By QPlace in forum Installation and Deployment
    Replies: 2
    Last Post: 3rd November 2008, 20:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.