Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7179667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:11:11+00:00 2026-05-28T17:11:11+00:00

my home assignment is to decipher a sentence based on a known and finite

  • 0

my home assignment is to decipher a sentence based on a known and finite dictionary.

Example:
Dict – show,blow,while

then the code 12345 8291 came as input.
if we will check the possibilities the the only option is “while show”.

can some one give me a direction or a known algorithm that handle this problem.
pseudo code or java will be great.

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:11:12+00:00Added an answer on May 28, 2026 at 5:11 pm

    You need to implement some kind of backtracking or other search technique. I’d suggest the following approach:

    1. Create a table of cipher-to-character translations. Initially, each cipher (digit) maps to 0 (nothing).
    2. Process the input. Every time you come across an unassigned cipher digit, you have a choice of letters based on the dictionary and what’s been determined so far. If there are no assignable letters, backtrack (or report failure in whatever way makes sense for your search technique). Add each choice to your search control logic. (For instance, if you’re using backtracking, save the list of choices and record an arbitrary choice in the translation table. If you backtrack to that point, assign another choice.)
    3. Proceed until you either get to the end or you run out of choices.

    EDIT: In step 2, the difficult part is determining what letters (if any) can be assigned to the next cipher digit. Suppose we are keeping track of the decoded current word and we want to process the next cipher digit in the word. We have a global map of cipher digit assignments already made. The logic might be something like this (in Java-ish pseudocode):

    Set assignableLetters(String wordSoFar, int nextCipher) {
        Character assignment = map.get(nextCipher);
        Set set = new Set();
        if (assignment != null) {
            // The next cipher is already assigned. Add the assignment to the
            // return set only if it is compatible with the dictionary contents
            if (dictionary.hasWordsWithPrefix(wordSoFar + assignment)) {
                set.add(assignment);
            }
        } else {
            // The next cipher is not assigned. We will return a set of all
            // compatible characters that can be assigned to it.
            for (Character c : unassignedCharacters()) {
                if (dictionary.hasWordsWithPrefix(wordSoFar + c)) {
                    set.add(c);
                }
            }
        }
        return set;
    }
    

    If this returns an empty set, the current assignment (before the method is called) is incompatible with the dictionary and the search must backtrack. Otherwise, the search should pick one assignment at a time from the set and continue, backtracking as necessary.

    Rather than trying each unassigned character and asking the dictionary whether it is compatible, it might be more efficient (but logically equivalent) to query the dictionary directly for the list of compatible next characters and intersect that with the unassigned character set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My home work assignment is to figure out: What this code does What potential
I'm having a problem with this home work assignment. I can handle the syntax,
Can Config::Simple work with properties file with variable assignment, e.g.: server_name=myapp.com home_url=${server_name}/home/index.html login_url=${server_name}/login/
I'm new to C++ and have to do a home assignment (sudoku). I'm stuck
I'm working on a home work assignment. The question is: Write an awk script
I need to do a home assignment in VC++, which uses ADT to do
Home Option 1 Option 2 And I apply the styles with this classes #contentheader
File: /home/USER/DIR/a http://www.here.is.a.hyper.link.net/ /home/USER/DIR/b http://www.here.is.another.hyper.link.net/ Need to remove all the odd lines in this
The Home sample in the android sdk doesn't implement the Add item, which bring
$mainMenu['Home'][1] = '/mult/index.php'; $mainMenu['Map'][1] = '/mult/kar.php'; $mainMenu['MapA'][2] = '/mult/kara.php'; $mainMenu['MapB'][2] = '/mult/karb.php'; $mainMenu['Contact'][1] =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.