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 4539192
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:54:47+00:00 2026-05-21T14:54:47+00:00

I don’t really know what more to say about this. I have never, ever

  • 0

I don’t really know what more to say about this.

I have never, ever seen this happen. And it just boggles me what causes this. I figured you guys might have seen this before and now what silly thing I am doing.

Notes about it: ‘temp’ is a variable the function is taking in. It is a Binary Tree Node (BTN). temp->d accesses the data. ->l is left child, ->r is right child. ->p is parent

NOTE: THIS IS HOMEWORK. IT IS FOR A PRIORITY QUEUE.

NOTE2: I have looked at similar questions. All have suggested a timing error and the ‘cout’ ‘slows’ the code down. What would cause this? I can’t think of any really ‘costly’ things I am doing.

  BTN<generic>* nTemp;
  cout << "Sdf\n";
  if(temp->r != NULL)
  {
    if(temp->l != NULL)
        {
          if(*(temp->r->d) > *(temp->l->d))
          {
            if(*(temp->r->d) > *(temp->d))
                {
                  cout << "ASDfs5: " << *(temp->d) << "\n";  //THIS IS WHAT KEEPS IT FROM BREAKING / SEGFAULTING
                  nTemp->d = temp->d; //THIS IS WHERE IT BREAKS (SEGFAULT)
                  cout << "ASDfs\n";
                  temp->d = temp->r->d;
                  cout << "ASDfs4\n";
                  temp->r->d = nTemp->d;
                            cout << "ASDfs3\n";
                  if(temp->r != NULL)
                  {
                    checkPopValues(temp->r);
                            cout << "ASDfs2\n";
                  }
                }
          }
          else
          {
            if(*(temp->l->d) > *(temp->d))
                {
                  nTemp->d = temp->d;
                  temp->d = temp->l->d;
                  temp->l->d = nTemp->d;
                  checkPopValues(temp->l);
                }
          }
        }
        else
        {
          if(*(temp->r->d) > *(temp->d))
          {
            nTemp->d = temp->d;
                temp->d = temp->r->d;
                temp->r->d = nTemp->d;
                checkPopValues(temp->r);
          }
        }
  }
  else
  {
    cout << "sdfs\n";
    if(temp->l != NULL)
        {
          if(*(temp->l->d) > *(temp->d))
      {
            nTemp->d = temp->d;
                temp->d = temp->l->d;
                temp->l->d = nTemp->d;
                checkPopValues(temp->l);
          }
        }
  }
}
  • 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-21T14:54:47+00:00Added an answer on May 21, 2026 at 2:54 pm

    Make sure nTemp is initialized. I bet it isn’t. The cout causes something “benign” to be placed in nTemp.

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

Sidebar

Related Questions

don't know if the title describes anything about what I'm trying to say but
Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't know if this has been answered before. Have custom routes to users. If
Don't know much about encryption... Say I'm preparing a SAML request to submit to
Don't know why but I can't find a solution to this. I have 3
don't know better title for this, but here's my code. I have class user
Don't really know how to formulate the title, but it should be pretty obvious
I don't know why, but this code worked for me a month ago... maybe
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know if this has been asked before, so point me to another question

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.