Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

java programming

Posted on 2004-09-26
9
Medium Priority
?
257 Views
Last Modified: 2010-05-18


This assignment will be creating all the permutations of a word using upper and lower case letters.  For a word that is n letters long the number of permutations is 2n.  For instance; given the word "are" the possible permutations include:

are
Are
ARe
ARE
ArE
aRe
aRE
arE

Please help me to write a java progarm?
0
Comment
Question by:sraveend
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 24

Accepted Solution

by:
sciuriware earned 1000 total points
ID: 12155165
No, homework is forbidden.

The only thing I will say is that every character has 2 states,
you might couple these to an array of booleans and
that to a split binary number of which the bits indicate the state (0 == lowercase).
By incrementing the binary number you can decode all possible strings.

Just try.

;JOOP!
0
 

Author Comment

by:sraveend
ID: 12159242
Could u please give me an example !!!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12160040
You must change characters, so you must choose between a char[] (very fast) and a StringBuffer (flexible).

For 3 characters you need:                       char[] array = new char[3];
You can count from 0 to 7 to address them:
       for(int i = 0;  i < 8;  ++i)
You can address those 3 characters by an integer:
              for(j = 0;  j < 3;  ++j)
To address 'array' from 'i' :
       if((i & (1<<j)) == 0)
       {
             array[j] = Character.toLowerCase(array[j]);
       }
       else
       {
             array[j] = Character.toUpperCase(array[j]);
       }


It's your turn now.....
;JOOP!
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:sraveend
ID: 12168930
Thanks a lot,it helped me to write the program correctly!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12170095
Ok, you may click [Accept] now.

Feel free to learn here, not just to copy from here (that's the rules).

;JOOP!
0
 

Author Comment

by:sraveend
ID: 12172853
Am sorry i searched & i coudn't get the link Accept........
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12176662
After every comment ....
0
 

Author Comment

by:sraveend
ID: 12180889
I could view accept when u gave me the first solution ,but now i could see only a word comment ,after every comment
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 12187280
Are you logged in as yourself?

;JOOP!
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question