Categories: AlgorithmMathematics

Finding Rank of a Word: With Repetition

Rank of a word

In the previous tutorial, we learn how to find the rank of a word, if the letters are having no repetition. Now lets learn how to find the rank of word, if the letters in a word having repetition.

Before proceeding to the tutorial: we should know, how to calculate the total number of words can be formed using letters of a word is the letters are repeating in nature.

Like how many words can be formed using letters of INDIA. In letter “INDIA” there are 2 I and no other letter is repeating. So the number of words that can form using letter of INDIA will be 5 ! / 2 ! = 60.

Now we may proceed with new learning.

Algorithm

1. First take that word which we have to find the rank and the letters are repeating in nature. I will take “BOMBAY.”

2. Now arrange the letter of ” BOMBAY ” in alphabetical order. Now they are “ABBMOY”.

3. Pickup first letter from “ABBMOY” that’s “A”. Now compare “A” from “BOMBAY”. Does the letter “A” in the first we want? NO. Now how many words can be made if we extract “A” from “ABBMOY”.

A = 5! / 2! = 60

Now proceed to the next.

4. Pickup second letter from “ABBMOY” that’s “B”. Now compare “B” from “BOMBAY”. Does the letter “B” in the first we want? Yes. Now fix the letter “B”.

[ B ]

Then go to once again on the first letter of “ABBMOY”. Does “A” we want? NO. Then write down how many words can be made with starting [ B ] A

[ B ] A = 4! = 24

5. Repeat the process until we get the letter which we want after B in the word “BOMBAY”.

[ B ] B = 4! = 24
[ B ] M = 4! = 24

[ B ] O. “O” we want. So fix this and get back to the starting.

6. Does we want now [ B O ] A? NO. So write down once again.

[ B O ] A = 3! = 6
[ B O ] B = 3! = 6

[ B O ] M. “M” we want now. So fix this too. And get back to the starting.

7. Does we want [ B O M ] A? No. So write down once again.

[ B O M ] A = 2! = 2

[ B O M] B. “B” we want. So fix this too. And get back to starting. We see “A” also we want now. So fix this too. And the last letter is “Y” We also want this. So we reach to the end. Now we can write.

[ B O M B A Y ] = 1.

 

8. Now add the entire sum which we earn.
That’s 60 + 24 +24 + 24 + 6 + 6 + 2 + 1 = 147. That’s the answer.

Now for Word “INDIA

1. [ A D I I N ]
2. A = 4! / 2! = 12
2. D = 4! / 2! = 12
3. [ I ] A = 3! = 6
4. [ I ] D = 3! = 6
5. [ I ] I = 3! = 6
6. [ I N ] A = 2! =2
7. [ I N D ] I A = 1.

Now add all.

12 + 12 + 6 + 6 + 6 + 2 + 1 = 45.

So that’s the answer. Congratulation now you are able to find RANK of any word if its letters are repeating in nature.

Surya

Living in permanent beta mode: Learning, Improving & evolving. SPECIALTIES: Web Application Development, Digital Media, E-Commerce Solutions, SEO, CRM Solutions, Open Source Technologies, System Administration ( Linux ), VOIP Solutions, Cloud Computing, Web Security.

View Comments

Share
Published by
Surya

Recent Posts

How to get the all the database and table sizes of MySQL or MariaDB?

If you are working with MySQL or MariaDB web server, sooner or later you will…

6 years ago

How to set or change default text editor for crontab in Linux?

To edit the crontab entries you use crontab -e. The command will check for the…

6 years ago

How to install Comodo SSL certificate with NGNIX web server?

Installation method for COMODO SSL Certificate If you have generated the CSR and purchased or…

6 years ago

How to give access to specific users to specific buckets on AWS S3

In AWS S3, you might want to provide the access to selected users to selected…

7 years ago

How to add or change the password (passphrase) of OpenSSH key?

It's possible you have earlier generated a ssh key without password/ passphrase. Later you found…

7 years ago

How to find files on linux OS ( distributions )

If you are working on Linux OS, finding files effectively always a tricky part. Like…

7 years ago