• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Java program to solve scramles

 
Greenhorn
Posts: 4
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Need help to associate a java netbeans ide program with any kinda dictionary to check out if any word found out by scramle exists or not..

Regards AsifSyed([email edited out. UseTheForumNotEmail])
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

Asif Syed wrote:Need help to associate a java netbeans ide programp



It doesn't matter what IDE you use. You can write the same program with any IDE, or with a text editor. And in fact, as a beginner, it's better if you don't use an IDE just yet.

with any kinda dictionary to check out if any word found out by scramle exists or not..



Your first step is to figure out how you'd do it "by hand." If you don't understand and cannot express simply and in details the steps for doing in without Java, you'll have an awfully hard time writing it in Java.

You'll also need to ShowSomeEffort(⇐click) and TellTheDetails(⇐click) about what you tried and what specific trouble you're having, in order for people here to be able to help you.

 
Asif Syed
Greenhorn
Posts: 4
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sir,
I am quiet familiar with java, and am planning to give my SCJP exam this month. I thing i cant figure out is how to associate my program with a dictionary.

My logic goes this way :
1) Find out all the words that can be made with the given scramble by combinations.(<== Have completed this one)
2) Check out the words that exists i the dictionary with a meaning and hence display it.(<== am stuck in this step.!)

Please help me out.!
 
Sheriff
Posts: 26776
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Asif Syed wrote:2) Check out the words that exists i the dictionary with a meaning and hence display it.(<== am stuck in this step.!)



It's hard to help without knowing how you have implemented your dictionary. So why don't you start by explaining that?
 
lowercase baba
Posts: 13002
66
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Asif Syed wrote:
2) Check out the words that exists i the dictionary with a meaning and hence display it.(<== am stuck in this step.!)


I see at least three pieces here:

1) check to see if the word exists in the dictionary
2) if it does, get the meaning
3) Display it

Which of these three are you stuck on? What have you tried?
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What kind of dictionary do you want to use? Some sort of offline dictionary? An online dictionary, perhaps using a webservice?

(In the latter case keep in mind you could generate so many requests to make the service provider very unhappy with you. Number of possible permutations grows very quickly with the number of letters. For a word composed of 8 unique letters this would be over 40 thousand requests.)
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Asif Syed wrote:Sir,
I am quiet familiar with java, and am planning to give my SCJP exam this month.



I'm not questioning your Java knowledge (though I've never seen any actual correlation between SCJP and Java knowledge).

I'm simply asking you to put a bit more effort into your research, your development process, and the question you post here.

I thing i cant figure out is how to associate my program with a dictionary.

My logic goes this way :
1) Find out all the words that can be made with the given scramble by combinations.(<== Have completed this one)
2) Check out the words that exists i the dictionary with a meaning and hence display it.(<== am stuck in this step.!)

Please help me out.!



What form does your dictionary take? Are you using an existing one, with its own API? Are you creating your own?

In the simplest case, you would simply have a Set or a sorted List of all the words, and it would be a simple matter of calling the contains() method, or else you'd have obtained some API and you would consult that API's docs to find out how to test for the existence of a word. However, since you're quite familiar with Java, you clearly already know that. Perhaps you could provide a little more detail about your approach and what in particular you're having trouble with?
 
Asif Syed
Greenhorn
Posts: 4
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nopes, I am done only with the first step. **@fred rosenberger

Cant think of what to do about the second.


This means, I cant understand how i can make my program find out the correct unscrambled word with the help of a dictionary!

Yea, that would generate a lot of words but amongst them i need to find out the meaningful one, that is why i need the help of the dictionary. **@fred rosenberger

Yea, I know, using a online dictionary, the service provider can be very unhappy with me,but in that case, I need to come over with an alternative, which at present I dont know(If you tell me, i can use that). **@martin vajsar

My main motive is to unscramble the scrambled words. **@paul clapham
 
Paul Clapham
Sheriff
Posts: 26776
82
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's still impossible to tell which of these is your problem:

(1) You don't know what data structure to use to implement a dictionary

(2) You don't know where to get the list of words to put into that data structure

Or is it both of them? Or something else?
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the simplest solution is that you can just store all your dictionary words in a map. Since, you already figured out how to get permutations of all the words that can be made using the provided letters, you just need to look up whether the permutation exists in the map

Not the best solution, but will work for small letter sets. Remember that the performance of this solution is O(n!) where n is the number of letters that you have. Or in other words, very very bad.

 
reply
    Bookmark Topic Watch Topic
  • New Topic