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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:59:09+00:00 2026-05-18T19:59:09+00:00

Can someone explain the output of calling mystery(root) on the binary tree below? struct

  • 0

Can someone explain the output of calling mystery(root) on the binary tree below?

struct treenode {
  int data;
  struct treenode* left;
  struct treenode* right;
}

void mystery(struct treenode* root) {
  if (root == NULL) return;
  mystery(root->right);
  printf("%d ", root->data%25);
  mystery(root->left);
}

Tree:

       35
    /      \
  23       17
 /  \     /
89  135  56
        /   \
       44    89
              \
              74
             /
            287     
  • 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-18T19:59:09+00:00Added an answer on May 18, 2026 at 7:59 pm

    See below trace:

    You call mystery(35)
    the root is not null which calls mystery(17)
        mystery(17) is not null and calls mystery(17-Right)
            This is null so it Returns
        printf(17%25 == 17)
        call mystery(56)
            mystery(56) is not null and calls mystery(89)
                mystery(89) is not null and calls mystery(74)
                        mystery(74) is not null and calls mystery(74-Right)
                        mystery(74-Right) is null; return;
                    printf(74%25 == 24)
                    mystery(74) calls mystery(287)
                        printf(287%25 == 12)
                    printf(89%25 == 14)
            printf(56%25 == 6)
            mystery(56) calls mystery(44)
                    mystery(44) has no right or left child
                    printf(44%25 == 19)
    printf(35%25 == 10)
    root calls mystery(23)
        mystery(23) calls mystery(135)
            printf(135%25 == 10)
        printf(23%25 == 23)
        mystery(23) calls mystery(89)
            printf(89%25 == 14)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone explain the output of calling mystery(root) on the binary tree below? struct
Below code gives the output as abc. Please can someone explain why its not
Can someone explain why this script throws an exception? $byteArray = @(1,2,3) write-Output (
Can someone help explain the following: If I type: a=`ls -l` Then the output
Can someone explain me the working of a malloc wrapper for below code?? RTLD_NEXT
Can someone explain the output of the following code char* a[] = {ABC123, DEF456,
Can someone explain to me how less, vi and curses programs manage graphics output?
When I run this code gcc gives me the output 10. Can someone explain
Can someone explain the output of the following code? #include <iostream> template <class T>
Can someone please explain why this program outputs 0x00000004? class AndAssignment { static void

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.