shabou

posted by .

Can someone please make a Binarytree of these methodes in Java?:
public void add(int element)
//Adds the specified element into this datastructure.

public void clear()
//Removes all of the elements from this datastructure.

public boolean contains(int element)
//Tests if the specified element is a component in this datastructure.

public int[] inOrder()
//Returns an array containing all of the elements in this datastructure inorder.

public int[] postOrder()
Returns an array containing all of the elements in this datastructure postorder.

public int[] preOrder()
Returns an array containing all of the elements in this datastructure preorder.

public void remove(int element)
Removes the specified element from this datastructure.

public int size()
Returns the number of components in this datastructure.

public int[] toArray()
Returns an array containing all of the elements in this datastructure inorder.

String toString()
Returns a string representation of this datastructure, containing the String representation of each element inorder

  • Computer Programming? -

    If you really want an expert to help you, be sure to follow directions and type your subject in the School Subject box. Any other words, including obscure abbreviations, are likely to delay responses from a teacher who knows that subject well.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Java

    1 public class testOperators 2 { 3 public static void main(String[] args) 4 { 5 int x; 6 int y = 12 7 double z = 13.0; 8 x = 14 9 System.out.println(“x + y + z = “ + (x + y +z)); 10 x += y; 11 y--; 12 z++; 13 z *= x; 14 System.out.println(“x …
  2. Java

    I need help putting the following trace into pseudocode 1 public class testOperators 2 { 3 public static void main(String[] args) 4 { 5 int x; 6 int y = 12 7 double z = 13.0; 8 x = 14 9 System.out.println(“x + y + z = “ + (x + …
  3. Programming

    Here is the source code for the Kitty class: public class Kitty { String name; int age; public Kitty(){ } public void setName(String n){ name = n; } public String getName(){ return name; } public void setAge(int a){ age = a; } public …
  4. Java Panel Problem

    I am supose to draw a grid and center it with a 10 pix border all the way around it. I have done this but no matter what I do I cannot get a 10 pix border. Here is my code. You will notice i have added 20 to the setsize param to account …
  5. computer science

    Im trying to create an arraylist that's sorted but I have no idea how to sort the numbers. I cant use the array.sort method here is my code: public class Testing { private int [] data; private int count; private static int defCapacity …
  6. programming

    m trying to create an arraylist that's sorted but I have no idea how to sort the numbers. I cant use the array.sort method here is my code: public class Testing { private int [] data; private int count; private static int defCapacity …
  7. Computer Science

    I posted this question before. The assignment was: write a Java method if the first parameter is less than the second parameter add the two and print the result ten times. How do I write the result 10 times as a loop?
  8. Computer Science

    How would I put this into one program? These are the directions: Write a method that takes two parameters. If the first parameter is equal to second parameter. Multiply both and print result. If the first parameter is less than the
  9. Computer Programming

    I already posted this question but I gave it a try I'm not sure if I'm on the right track: Make a util class with three methods. First method's name is add, that returns the result by adding two numbers. Second method's name is multiply, …
  10. Java programming

    Hi, I'm trying to figure out how to implement toString() methods into the JavaTest and H2ClassB classes so that the output would be 4 3 7 5 99 3: import java.util.ArrayList; public class JavaTest { ArrayList <JavaTest> list = …

More Similar Questions