how to make a binary tree from an external file ??
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how to make a binary tree from an external file ??
My assessment is making a tree from a text file as follows: -reading a file line by line
-making a binary tree from it
- traverse by level the binary tree
- posting the traversal result to the same file without overwriting the text file- it is required to be append to the bottom of the text file
(i have to do this in 4 languages: c#,PHP from Xampp,java, python)
-----------------------------
i read the file with this script in java:
return stringArray;
}//end of get string
public static void main(String arg[]){
String x[] = new FileToStringArray("file.txt").getString();
for(int i = 1; i<x.length;i++){
System.out.println(x[i]);
}
}//end of main
}//end of class
---------------
but how i can make a binary tree from this point???
that's your option! i don't condemn anyone who don't have any interest to help !!! i wish you all the best!
maybe i've made a mistake from my side!!! sorry......
If I were the organization conducting the assessment, I would search on the Internet for elements from each person's code (the code you've shown us, for example) to see whether anyone was getting outside help, which would imply cheating. For the sake of your own continuing moral maturation (a journey none of us ever finish), I hope they catch you.
I've quoted your code, so you can't edit it away. Your only guarantee against being caught is to completely rewrite your code.
Go and sin no more.
Quote:
Originally Posted by sorinclaudiu
My assessment is making a tree from a text file as follows: -reading a file line by line
-making a binary tree from it
- traverse by level the binary tree
- posting the traversal result to the same file without overwriting the text file- it is required to be append to the bottom of the text file
(i have to do this in 4 languages: c#,PHP from Xampp,java, python)
-----------------------------
i read the file with this script in java:
return stringArray;
}//end of get string
public static void main(String arg[]){
String x[] = new FileToStringArray("file.txt").getString();
for(int i = 1; i<x.length;i++){
System.out.println(x[i]);
}
}//end of main
}//end of class
---------------
but how i can make a binary tree from this point???
If I were the organization conducting the assessment, I would search on the Internet for elements from each person's code (the code you've shown us, for example) to see whether anyone was getting outside help, which would imply cheating. For the sake of your own continuing moral maturation (a journey none of us ever finish), I hope they catch you.
I've quoted your code, so you can't edit it away. Your only guarantee against being caught is to completely rewrite your code.
Go and sin no more.
I don't know what are you talking about!!!! i am not a thiever and you are totally wrong from all points of view!!!!
maybe you have another problem which doesn't have any related link with my task!!! I haven't applied for any kind of job as you are sustaining!!! you are totally wrong !! nobody will asses my knowledge !!!!!i am not a developer and i am not gaining my life from that ...i have attended high level studies ... i am a wide minded person...
don't talk about what you really don,t know...you really overcome and overestimated you.
I don't know what are you talking about!!!! i am not a thiever and you are totally wrong from all points of view!!!!
maybe you have another problem which doesn't have any related link with my task!!! I haven't applied for any kind of job as you are sustaining!!! you are totally wrong !! nobody will asses my knowledge !!!!!i am not a developer and i am not gaining my life from that ...i have attended high level studies ... i am a wide minded person...
don't talk about what you really don,t know...you really overcome and overestimated you.
I can see that English is not your first language. Perhaps you chose the wrong word when you said "assessment." What did you actually mean?
Usually, a programming assessment is a test given by a potential employer to test the skill levels of candidates.
you really don't understand anything!! i had to asses my knowledge!!!! you are too narrow minded!!
i will not complicate anymore with this forum !!
also it demonstrated me that is very useless!!
this forum is totally useless!!!!!!!!!!!!!!!!!!!!!!!!!!!1
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.