programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Rob Spoor
• Devaka Cooray
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Frits Walraven
• Tim Moores
Bartenders:
• Mikalai Zaikin

Need ideas ......or hints...

Greenhorn
Posts: 4
• Number of slices to send:
Optional 'thank-you' note:
guys I got a problem to solve... its on tree vertex splitting problem

1. Write a program to solve the tree vertex splitting problem?

I like to do everything myself. but on this problem I cannot see any ideas on internet.. Can anyone give the data structure on how to code this program..

I will try to write a program myself, I will code.. I'm not asking code.but any hints or ideas. that how should I start and finish this assignment.

thank you

author and iconoclast
Posts: 24207
46
• Number of slices to send:
Optional 'thank-you' note:
Hi,

Welcome to JavaRanch!

It helps to break things down into smaller steps. For example, you might start with:

//1) Collect inputs
//2) Solve tree vertex splitting problem
//3) Print output

Now, you might not think this has helped much, but now you can start asking useful questions, like "what should the inputs to step #2 be?" In other words, think about what "the tree vertex splitting problem" means; think about however you learned about it in class. What are the data structures that you'd be operating on in solving the problem? Hmmm... that suggests another step belongs in there:

//1a) Collect inputs
//1b) Build data structure
//2) Solve tree vertex splitting problem
//3) Print output

Now think about #2, again. Did the teacher tell you an algorithm to use, or do you have to work one out on your own? If he told you one, then write down all the steps, one at a time, under #2. If you have to figure out how to solve it yourself, well, then do so. When you figure it out, write down the steps.

Notice how I put Java comment marks at the beginning of each line? Now start writing code below the comment lines, leaving the comments there.

So go ahead: give it a try. When you've got at least a decent outline of the program, post it below and we can give you some hints if you need them.

One more thing: as soon as you start writing code, compile it. Get an empty class definition to compile. Then get a class with "main" declared in it to compile, with an empty method body. Then declare a few variables, and get that to compile.

Whatever you do, don't write 200 lines of code -- or even 50 lines of code --and then try to compile it. Take little steps, making sure that your code is OK at each point. You'll save a lot of time!

And each time you compile the program, run it. Make sure it does what it's supposed to. Don't wait until the whole thing is written to start testing!

Peter vanscoy
Greenhorn
Posts: 4
• Number of slices to send:
Optional 'thank-you' note:

Basically my teacher didn't give any algorithm.. All he said to do the program.. and should not be a binary tree...It should be n-arrays.
So I don't know how to start. So thought of getting ideas from Javaranch.
So when you said,
1. getting inputs.. Do i read from the file .

would you happen to know what would be algorithm...

Help me if you can..

Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
• Number of slices to send:
Optional 'thank-you' note:
Remember that the number one rule of success in school is

If you don't understand the assignment, ask the instructor for clarification.

In any case, for step 1, it's entirely up to you. If it's convenient to store test data in a file, do so. If it's convenient to type it in, do so. And if it's convenient to simply hard-code the data, that would be OK too -- although it won't be as easy to test your program with different inputs.

And then as far as whether I know the algorithm -- that doesn't much matter, does it? Presumably this is what you're supposed to be learning in class. Let's instead help you to remember what you learned. So first, let's hear you state, clearly, what the problem is.

Peter vanscoy
Greenhorn
Posts: 4
• Number of slices to send:
Optional 'thank-you' note:
sounds good

Peter vanscoy
Greenhorn
Posts: 4
• Number of slices to send:
Optional 'thank-you' note:
I couldn't figure out the algorithm for tree vertex splitting. Can any one give me some ideas or hints how to this...

Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
• Number of slices to send:
Optional 'thank-you' note:
As I suggested, let's start at the beginning. Tell us, in your words, what the tree vertex splitting problem is. You can't write a program without knowing what it needs to do -- whether or not you know how to do it comes later.

 Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters?