Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6906091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:15:56+00:00 2026-05-27T08:15:56+00:00

i get those errors when i try to compile a simple AVL tree program

  • 0

i get those errors when i try to compile a simple AVL tree program :

no matching function for call to A::max(A*&, A*&)
candidates are: int A::max(A&, A&)
request for member 'levels' in 'b', wich is of non-class type 'A*' 

Here is the method that cause the problems :

void A::simpleLeftRotation(A & tree){
   A* b = tree.leftNode;
   tree.leftNode = b->RightNode;
   b->rightNode = &tree;
   tree.levels = 1 + max(tree.leftNode, tree.rightNode); // Problem 1
   b.levels = 1 + max(b.rightNode, tree); // Problem 2
   tree = b;       
}

And here are my class Members :

A* righNode;
A* leftNode;
int levels;
int element;

In the line :

b.levels = 1 + max(b.rightNode, tree);

if i use the -> insted of the point operator i get :

no matching function for call to A::max(A*&, A&)
candidates are: int A::max(A&, A&)

I dont know what i am doing wrong.
Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:15:56+00:00Added an answer on May 27, 2026 at 8:15 am

    Although you didn’t show us the declarations for all the types, I suspect this will fix the problem:

    tree.levels = 1 + max(*(tree.leftNode), *(tree.rightNode));
    b.levels = 1 + max(*(b.rightNode), tree);
    

    Originally, you were passing pointers in when the max function expects references. Hence, a type mismatch leading to your errors. So you need to dereference your pointers as shown.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try to compile to following code, I get two errors: Description Resource
I continually get these errors when I try to update tables based on another
The short version: I try to compile MAGMA and get complains about missing symbols:
I get an error whenever I try to create a simple edge from a
I am having trouble validating my xml schema. I get these errors on the
stupid problem. I get those from a client connecting to a server. Sadly, the
I have my current location fixed via CoreLocation. Now I want to get those
I need to write a SQL query which will get me those rows from
I have a set of .EXE commands. How do I get all those commands
I'm looking for a way to get and set those oddball chunks in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.