473,385 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

BinryTree Traversal preorder return preorder Expression as String

Hi,

I have problem with following method that we used for BinryTree Traversal. The follow method is good so far.

Expand|Select|Wrap|Line Numbers
  1. public void preorderHelper(MyBinaryTreeNode rt){
  2.  if(rt==null)
  3.  return;
  4.  System.out.print(" "+rt.data);
  5.  preorderHelper(rt.left);
  6.  preorderHelper(rt.right); 
  7. }
  8.  
But,


Now I have to change this method in such a way that it will return String(which will contains preorder expression).


Expand|Select|Wrap|Line Numbers
  1. public String preorderHelper(MyBinaryTreeNode rt){
  2.   /*
  3.  
  4.  ??????????
  5.  */
  6. }
  7.  


Any Idea. Thank you in Advance.
Apr 23 '12 #1
0 1218

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: kurt hansen | last post by:
hi I thought that this would be easy, but maybe not so much. I want to: pass an xpath expression and a string value to a stylesheet and copy the source xml document, changing the value of...
5
by: KidLogik | last post by:
Hello! I am converting an infix expression string into a postfix so that I will be able to evaluate it easier -> (5*(((9+8)*(4*6))+7)) == 598+46**7+* I believe the rule is "Replace all...
0
by: Dave | last post by:
I am trying to return a regular expression from code behind to server control in aspx page. Problem is regularexpressionvalidator tag interprets string incorrectly. // aspx...
4
by: Zeng | last post by:
Hello, I just wonder if there is a way to programmatically evaluate expression strings such as ( ( 3 + 5 ) / 2 ) > 4 --> this should return 0 or false ( ( 3 + 6 ) / 3 ) > ( ( 5 + 3 ) / 4 ) ...
1
by: paulsmith5 | last post by:
Hi, I'm developing a web app and I want to validate a users input on a form. I need a regular expression to validate a string which must begin with a letter (i.e. A-Z or a-z) and must have 5...
3
by: cybergoth_0 | last post by:
I have a table with a column called AccessTypes which contains a single letter. I want to return these accesstypes from a query into one string. e.g. if there were 3 entries of A, S and D I...
10
by: howa | last post by:
#include <iostream> using namespace std; const char* test(char *src) { string s(src); return s.c_str(); }
4
by: kalaisuresh | last post by:
Hi, I want to remove the carriage return from the string using c++. please anybody tell me. i am reading the string from another file.(each string is a single line);
2
by: noagbodjivictor | last post by:
I'm filling an array with user input, I want an empty string to be returned when nothing is entered; ie return key hit twice... How do I do that?
11
by: nembo kid | last post by:
My homework is to make a simple function that, given a unsigned char, should returns its bit string representation. I tried to drop down some code (as follows) but it doesn't work. Compiling is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.