Question # 4.
(a) Determine the number of ways to rearrange the letters in the
word QUESTION.
(b) Determine the number of ways to rearrange the letters in the word BOOKKEEPERS.
(c) Determine the number of ways to rearrange the letters in the word SUCCESSFULLY, assuming that all the Ss are kept together, and the E and F are not side-by-side
In: Statistics and Probability
Write a recursive method using Java that takes a string s as input and returns a list that contains all the anagrams of the string s. An anagram is a word formed by rearranging the letters of a different word. For instance, the word ‘cat’ is an anagram of ‘act’. Notice that the output list cannot contain duplicates.
In: Computer Science
A 12-bit Hamming code word containing 8 data bits and 4 parity bits is read from memory. What was the original 12-bit word written into memory, if the 12-bit word read were the following?
(i) 000011101010
(ii) 101110000110
(iii) 101111110100
In: Electrical Engineering
Jenson grew up with beagles, which he first learned to associate with the word "doggie." Even as an adult, Jenson still thinks of a beagle upon hearing the word "dog." To him, a beagle is an example of a ______________ for the word "dog."
A. Mental set
B. Algorithm
C. Prototype
D. Heuristic
In: Psychology
Solve using PYTHON PROGRAMMING
9. Write a script that reads a file “ai_trends.txt”, into a list of words, eliminates from the list of words the words in the file “stopwords_en.txt” and then
a. Calculates the average occurrence of the words. Occurrence is the number of times a word is appearing in the text
b. Calculates the longest word
c. Calculates the average word length. This is based on the unique words: each word counts as one
d. Create a bar chart with the 10 most frequent words.
Solve using PYTHON PROGRAMMING
In: Computer Science
The syntax of the monkey languages is quite simple, yet only monkeys can speak it without making mistakes. The alphabet of the language is {a, b, d, #}, where # stands or a space. The grammar is
<stop> ::= b|d
<plosive> ::= <stop>a
<syllable> ::= <plosive>|<plosive><stop>|a<plosive>|a<stop>
<word> ::= <syllable>|<syllable><word><syllable>
<sentence> ::= <word>|<sentence>#<word>
Using parse trees, which of the following speakers is the secret agent masquerading as a monkey?
Chimp: abdabaadab#ada
Baboon: dad#ad#abaadad#badadbaad
In: Computer Science
Q20. Using C++ style string to write a program that reads a sentence as input and converts each word of the sentence following the rule below:
More requirements:
More assumptions:
Sample Run:
Please enter the original sentence: i LOVE to program Translated: IKPU OVELKPU OTKPU ROGRAMPKPU
In: Computer Science
Q20. Using C++ style string to write a program that reads a sentence as input and converts each word of the sentence following the rule below:
More requirements:
More assumptions:
Sample Run:
Please enter the original sentence: i LOVE to program Translated: IKPU OVELKPU OTKPU ROGRAMPKPU
In: Computer Science
I get an error in my code, here is the prompt and code along with the error.
Write a spell checking program (java) which uses a dictionary of words (input by the user as a string) to find misspelled words in a second string, the test string. Your program should prompt the user for the input string and the dictionary string. A valid dictionary string contains an alphabetized list of words.
Functional requirements:
CODE:
dictionary.java
import java.io.*;
import java.util.*;
public class dictionary
{
public static void main(String args[]) throws Exception
{
String dString;
String uString;
Scanner input=new Scanner(System.in);
System.out.println("Enter distionary string :");
dString = input.nextLine();
System.out.println("Enter input string :");
uString = input.nextLine();
String[] dict = dString.split(" ");//split dictionay
string and save to array fo string
boolean found = false;
//ieterate over dictionary string array
for (String a : dict)
{
//compare and print message
accordingly
if((uString.toLowerCase().compareTo(a.toLowerCase())) == 0)
{
System.out.println("word found!");
found =
true;
break;
}
}
if(found == false)
{
System.out.println("Unknown word
found!");
}
}
}
ERROR:
Main.java:4: error: class dictionary is public, should be
declared in a file named dictionary.java
public class dictionary
^
1 error
compiler exit status 1
In: Computer Science
In programming C language, write a program that creates a binary
tree of words to be used as a spell
checking device for various text files. The list of words will come
from a file “words.txt”.
Your program is to read through the “words.txt” file and insert the
word on that line into the tree
in lexicographic order (also known as Dictionary order). Words in
the file will be separated by
spaces. Once this is done, your program should then prompt the user
to enter a text file and
then scan through each word in the file to check spelling.
Your program must be able to insert words into and delete words
from the tree. It must also be
able to search the tree for a given string (this is how the spell
check is done), and print the tree
in pre order, in order, and post order.
The functions that do this should look as follows:
● void insert(root, s): node x char* -> none
○ inserts a node whose data is s into the tree with root node
root
● void delete(root, s): node x char* -> none
○ deletes a node whose data is s from the tree with root node
root
● void print_preorder(root): node -> none
○ prints the tree with root node root in pre-order format
● void print_inorder(root): node -> none
○ prints the tree with root node root in in-order format
● void print_postorder(root): node -> none
○ prints the tree with root node root in post-order format
● node search(root, s): node x char* -> node
○ searches a tree with root node root for a node whose data is s,
if it is found then
that node is returned, otherwise a NULL node is returned
For the spell-checking portion of the program, there should be a
function spellcheck which takes
as arguments a root node for your tree, and a string for a
filename. Spellcheck should scan the
file at that location word by word and check if that word is in the
tree, ignoring capitalization and
punctuation (apostrophes are not considered to be punctuation). If
the word is not found then a
message should be printed to the console indicating that word is
not found / misspelled. The
message should indicate the word’s position in the file.
● void spellcheck(root, filename): node x char* -> none
○ Scans a text file (filename) word by word, prints a message to
the console if a
word is not found in the tree of correct words.
Sample Input/Output
words.txt: “all work and no play makes a dull boy”
myInput.txt: “All work and no play maks Jack a dull boy.”
Output:
“Word “maks” on line 1, word 6 mispelled or not found in
dictionary.”
“Word “Jack” on line 1, word 7 mispelled or not found in
dictionary.”
Again, in programming C language please.
In: Computer Science