• Post Reply Bookmark Topic Watch Topic
  • New Topic
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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

a problem with my program..

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got my program solved
its solving much more cases then needed

i was asked to solve it for chars a-z and space char
27

and i was told that in each root of the tree i will get
27 branches (one branch for each char)

but my version solves for every kind of char
i dont know how to check how many branches are there in that tree.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to determine how many roots exist for the tree. Where is this information held?
 
johny doe
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i realy dont know where to look its a lot of code
some of the comments are

/* We store the tree as a parent-pointer tree, hashed */
/* Code adapted from _The_Data_Compression_Book_ */
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See if you can post what looks like the relevant code, and perhaps someone can assist. Don't post the whole of the code if it is substantial as nobody will read it.
 
johny doe
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how do i build a tree with 27 branches??

maybe i'll find a similar stucture
[ January 05, 2008: Message edited by: johny doe ]
 
Marshal
Posts: 80634
471
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure what to suggest, but . . .

. . . if it actually works, do you need to change it to 27 characters?
 
johny doe
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it will be much yeasier to understand if ill send you privately the
code
it that ok?
 
johny doe
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my big problem in that software is an applet

that takes it input from a text box

and outputs to another text box
and i want to change it so it will take
its input from a text file and return the output
into a text file
and so it will not be an applet but a normal code
with
public static void main(String []args)

can you guide me threw the proccess??

can i send you the code privately??

[ January 06, 2008: Message edited by: johny doe ]
[ January 06, 2008: Message edited by: johny doe ]
 
Campbell Ritchie
Marshal
Posts: 80634
471
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know anything about this LZ algorithm, but please don't send code in a PM. Better to post a few pages openly so everybody can read it and other people with similar problems can learn too.
 
johny doe
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok lets start from the problem that it gets its input from a text box
and i want it to take the input from txt file

how do i do that??

another point is how to change it from applet to normal form

what parts do you want me to post for this tasks??
[ January 07, 2008: Message edited by: johny doe ]
 
Campbell Ritchie
Marshal
Posts: 80634
471
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggested you use java.util.Scanner for text file input. Have you tried that?
 
johny doe
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i looked for it
but i dont know how to recognise and remove
the messange box parts and
instead to put the txt reader thing

i am realy new to this applet thing
this massage box mechanism

that why i want some one to lokk on my project to help me with that

i realy dont mind to share it the second after the dead line


???
 
Campbell Ritchie
Marshal
Posts: 80634
471
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is an example of a Scanner reading from a text fileIt actually comes from the API specifications. You should be able to change the bit about nextLong() to next() or nextLine(). Do something more inspired than setting up a local variable which is never used!

I am not sure which part of your code it would be best to past. Sorry.
 
johny doe
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
where do i put the path of the file here

the purpose is to take a txt file (which contains a continues line of chars)
and convert it into string

in your code i dont recognize the place where to put the path of the txt file
and the output String variable
??
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic