> If node > key, we are going "left", so smaller values should be on the left 
> side
> of the tree for this to make sense, correct?

Ok, the order of operands for the compare function and how that maps to res > 0 
makes for confusion... Now I get it...

I have another question, I'm trying to understand what avltree_inf and 
avltree_sup are supposed to accomplish.

I have need of a function to find the nodes that would be on either side of a 
particular key without inserting the key into the tree (at which point of 
course one could get avltree_prev and avltree_next).

Thanks

Frank

> Regards, Malahal.
> 
> On Thu, Mar 9, 2017 at 6:35 AM, Frank Filz <ffilz...@mindspring.com> wrote:
> > Looking at the AVL code, I'm wondering what order it sorts in.
> >
> > I'm confused by the following code:
> >
> >         while (node) {
> >                 res = avl_dirent_hk_cmpf(node, key);
> >                 if (res == 0)
> >                         return node;
> >                 if (res > 0)
> >                         node = node->left;
> >                 else
> >                         node = node->right;
> >         }
> >
> > Given that the comparison functions return -1, 0, 1 for <, ==, >, it
> > seems like it effectively sorts in reverse order.
> >
> > Is that correct, or am I confused how the tree works...
> >
> > Frank
> >
> >
> >
> > ---
> > This email has been checked for viruses by Avast antivirus software.
> > https://www.avast.com/antivirus
> >
> >
> > ----------------------------------------------------------------------
> > -------- Announcing the Oxford Dictionaries API! The API offers
> > world-renowned dictionary content that is easy and intuitive to
> > access. Sign up for an account today to start using our lexical data
> > to power your apps and projects. Get started today and enter our
> > developer competition.
> > http://sdm.link/oxford
> > _______________________________________________
> > Nfs-ganesha-devel mailing list
> > Nfs-ganesha-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Nfs-ganesha-devel mailing list
Nfs-ganesha-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel

Reply via email to