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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T13:03:29+00:00 2026-05-22T13:03:29+00:00

So, my doctor asking me to implement treeSort() and then test it on int[1000000]

  • 0

So, my doctor asking me to implement treeSort() and then test it on int[1000000] and calculate the time.

I have class BSTree<E> which contains the following methods:

public void treeSort(E[] data)
{
    inorder(data, new Process<E>(), root);
}

public static <E> void inorder(E[] list, Process<E> proc, BTNode<E> p)
{
    if (p != null)
    {
        inorder(list, proc, p.getLeft( ));    // Traverse its left subtree
        proc.append(list, p.getElement( ));   // Process the node
        inorder(list, proc, p.getRight( ));   // Traverse its right subtree
    }
}

and I have Process<E> class:

public class Process<E>
{
    private int counter = 0;
    public void append(E[] list, E element)
    {
        list[counter] = element;
        counter++;
    }
}

and I have the following Main class:

public class Main
{
    public static void main(String[] args)
    {
        int[] temp = {4,2,6,4,5,2,9,7,11,0,-1,4,-5};
        treeSort(temp);
        for(int s : temp) System.out.println(s);
    }

    public static void treeSort(int[] data)
    {
        BSTree<Integer> tree = new BSTree<Integer>();
        for(int i: data) tree.insert(i);
        tree.inorder(data, new Process<Integer>(), tree.getRoot()); // I get an error here!
    }
}

The error is:

cannot find symbol - method inorder(int[], Process<java.lang.Integer>, BTNode<java.lang.Integer>); maybe you meant: inorder(E[], Process<E>, BTNode<E>);

I fixed that by changing treeSort(int[] data) to treeSort(Integer[] data). But I got an error in the main method at treeSort(temp);

and the error is:

treeSort(java.lang.Integer) in Main cannot be applied to (int[])

So, how can I deal with this issue with taking into account not increasing the complexity time where I should try this method upon 1 million inputs?

  • 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-22T13:03:29+00:00Added an answer on May 22, 2026 at 1:03 pm

    Integer[]temp = {4,2,6,4,5,2,9,7,11,0,-1,4,-5};

    EDIT: use it to fix second error.

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

Sidebar

Related Questions

I have a string as $email_string='Aslam Doctor <aslam.doctor@gmail.com>'; From which I want to extract
I have written a jsp redirect in my jsp page like this <s:if test=#session.Doctor
I have a method: internal List<int> GetOldDoctorsIDs { var Result = from DataRow doctor
I have two associated models, employee and doctor: class Employee < ActiveRecord::Base has_one :doctor,
I have a table with doctor offices and doctors in those offices that I'm
We are an organisation who have purchased a system which is used by doctors
I'm having a problem right now, I have 2 domain classes namely Doctor and
I have a system that have 3 roles of user (doctor,patient,admin) and patient user
I have this data ReferenceDataLocation = as ############################################################################## # # LicenseKey # Address Doctor
I have a query to fetch the nearest future doctor appointment for the users

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.