How can I take an input word (or sequence of letters) and output a word from a dictionary that contains exactly those letters?
Does java has an English dictionary class (list of words) that I can use, or are there open source implementations of this?
How can I optimize my code if this needs to be done repeatedly?
...
This has been plaguing me for weeks. It's something really simple, I know it. Every time I print a singly linked list, it prints an address at the end of the list.
#include <iostream>
using namespace std;
struct node
{
int info;
node *link;
};
node *before(node *head);
node *after(node *head);
void middle(node *head, node *ptr);
v...
Hi everyone!
I'm having some trouble making a Makefile. Write now I just compile everything every time. Although, the professor is ok with that, I do want to get it working faster and to avoid unnecessary compiling.
Here's what I have.
FILES= p6.cpp SetIter.cpp Node.cpp Set.cpp
CFLAGS= -ansi -pendantic -Wall -Wextra
CC= g++
MakePg6...
Hello. I have this problem where i need to convert the following CFG to CFG in CNF.
S-> ABa
A-> aab
B-> Ac
I know the steps are as follows.
Remove epsilon transitions - Done
remove unit productions
convert to CNF by:
introduce a new non terminal for each term
replace terminals in the productions rules with the new nonterminal
i...
N=5
For(rate=0.05, rate <= 0.15, rate = rate +0.05)
For(principle=1000, principle <= 1500, principle=principle + 1000)
simple = principle * (1 + rate * N) #Where N is the number of years
compound = principle * (1 + rate) ^ N
print simple + " " + compound
End For
End For
...
This is probably really easy, but I'm lost on how to "make sure" it is in this range..
So basically we have class Color and many functions to implement from it.
this function I need is:
Effects: corrects a color value to be within 0-255 inclusive. If value is outside this range, adjusts to either 0 or 255, whichever is closer.
This i...
I need to convert a string inputed by a user into morse code. The way our professor wants us to do this is to read from a morseCode.txt file, seperate the letters from the morseCode into two lists, then convert each letter to morse code (inserting a new line when there is a space).
I have the beginning. What it does is reads the morseCo...
I need to reduce this boolean expression to its simplest form. Its given that the simplest form contains
3 terms and 7 literals.
The expression is:
x'yz + w'x'z + x'y + wxy + w'y'z
We tried this in class, and even out recitation teacher could not figure it out.
Any help would be appreciated.
...
Hey guys, I was assigned to create a program that creates n arrays composed by 10 random integers. The the program should sum all the integers and display the result. After, it has to verify which of the sums is the greatest and it has to display that array and the result. Im having troubles getting it done and would like to get some hel...
I'm reviewing my old algorithms notes and have come across this proof. It was from an assignment I had and I got it correct, but I feel that the proof certainly lacks.
The question is to prove that the distance values taken from the priority queue in Dijkstra's algorithm is a non-decreasing sequence.
My proof goes as follows:
Pr...
Once more something relatively simple, but confused as to what they want.
the method to find distance on cartesian coordinate system is
distance=sqrt[(x2-x1)^2 + (y2-y1)^2]
but how do i apply it here?
//Requires: testColor to be a valid Color
//Effects: returns the "distance" between the current Pixel's color and
// ...
Run a recursive listing of all the
files in /var/log and redirect
standard output to a file called
lsout.txt in your home directory.
Complete this question WITHOUT leaving
your home directory.
An: ls -R /var/log/ >
/home/bqiu/lsout.txt
I reckon the above bash command is not correct. Because I found what it store...
How to count the number of right children in a binary tree?
This means that I only want the children marked as right.
Ex.
(Left | Right)
F(Root)
G | H
T U | I J
The right children would be U,H,and J.
What would be the algorithm to find these.
...
I was wondering what the easiest way is to convert an integer to the equivalent number of blank spaces. I need it for the spaces between nodes when printing a binary search tree. I tried this
int position = printNode.getPosition();
String formatter = "%1"+position+"s%2$s\n";
System.out.format(formatter, "", node.element);
But ...
how can i get all permutation of words in a sentence.can you give a sample c# code for that?
eg: if the sentence is "C# not java",
the output should be, 1)c# not java 2)c# java not 3)java not c# 4)java c# not 5)not java c# 6)not c# java etc.
...
I basically have to write a clone of the UNIX ls command for a class, and I've got almost everything working. One thing I can't seem to figure out how to do is check whether a file is a symbolic link or not. From the man page for stat(), I see that there is a mode_t value defined, S_IFLNK.
This is how I'm trying to check whether a file ...
Hi everybody.. I am a student of 3rd year engineering and only a novice in my programming skills. I need some help with my project.. I wish to develop a two player game to be played over the network (Intranet).
I want to develop a simple website with a few html pages for this.My ideas for the project run as follows:
1.People can log in...
Hello,
I am trying to write a frequency program that will represent a bar diagram (in console code).
The problem is i have no idea how exactly to caculate this frequency or how do i exactly then give the bars different heights according to there frequency (trough calculation).
The frequency height is capped at 21. (meaning the bars go...
Write an application that inputs one number consisting of FIVE digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each. For example, if the user types in the number 12345, the program should print
1 2 3 4 5
The following screen dump of result i...
I have the following Polynomial class I'm working on:
#include <iostream>
using namespace std;
class Polynomial
{
//define private member functions
private:
int coef[100]; // array of coefficients
// coef[0] would hold all coefficients of x^0
// coef[1] would hold all x^1
// coef[n] = x^n ...
int deg; // degree...