I have create the following insert method by researching the internet but I know it needs some work since it quite bulky and unsightly. I have tested it and it works fairly well but I know it could work better. If possible could someone show me how to convert this method to use parameters and/or increase its efficency?
public static vo...
This is a homework question from compiler design course. I just need an explanation of certain parts of the question.
It is claimed that returning blocks to the standard memory manager
would require much administration. Why
is it not enough to have a single
counter per block, which holds the
number of busy records for that bl...
I have an issue with my C++ code for college. I can't seem to understand why my sRecSort() method isn't working.
Any help? This is really confusing me!
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <sstream>
using namespace std;
void sRecSort(string n[], int s[], string e[], int len){
for (in...
Please order the function belows by growth rate
n ^ 1.5
n ^ 0.5 + log n
n log ^ 2 n
n log ( n ^ 2 )
n log log n
n ^ 2 + log n
n log n
n
ps:
Ordering by growth rate means, as n gets larger and larger, which function will eventually be higher in value than the others.
ps2. I have ordered most of the functions:
n , n log log n, n log n,...
FYI This is homework. I have to build a Java Chat server. I have been able to build a server which communicates with 1 client. But I need this to communicate with multiple users.
A user is supposed to type in the person's name they wish to talk to followed by a dash (-) and then the message to be sent. I am able to get users signed on b...
I'm trying to use the following code to convert every letters from a paragraph (strings) into lowercase letters before storing it back to the string. But the compiler wouldn't compile =(
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void spellCheck(char article[], char dictionary[]) {
int i = 0;
char* tempArticle;
...
Hi,
I have a task to write a (toy) parser for a (toy) grammar using OCaml and not sure how to start (and proceed with) this problem.
Here's a sample Awk grammar:
type ('nonterm, 'term) symbol = N of 'nonterm | T of 'term;;
type awksub_nonterminals = Expr | Term | Lvalue | Incrop | Binop | Num;;
let awksub_grammar =
(Expr,
funct...
I am getting stuck with the class work we got this week and its a subject i really want to learn so for once i thought i would do the additional reading!!!!
The method is provided for us and i am just writign some test cases. This is where my knowledge gets a little hazy. If the time increases then i am underestimatign the complexity i ...
The questions:
What I've done:
But I've got totally no idea the difference between 3.5 and 3.6.
...
I'm currently working on my first GUI Programming project in Java as a school assignment. I've gotten pretty familiar with setting up classes and methods in Java, though with the introduction to GUI programming, I'm not sure how best to go about it.
I've set up the GUI in its own package. Should I make a new class for each JPanel? I've...
I'm trying to figure out what data structure to quickly support the following operations:
Add a string (if it's not there, add it, if it is there, increment a counter for the word)
Count a given string (look up by string and then read the counter)
I'm debating between a hash table or a trie. From my understanding a hash table is fast...
hello everyone. I'm a beginner to C programming. I'm trying to learning how to code a spell checker that looks through all the words in a dictionary file, compare them with an article, print out all the words that do not exist in the dictionary file onto the console. Since I'm studying malloc in class, I've lowercased every word, removed...
I've debugged my program and the arrays seem to be allocated well. However for some strange and stupid reason, the code doesn't output the arrays into the file.
Please help me spot my bug or such!
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
using namespace std;
void sRecSort(string *n, int *s, string...
I have a file,named f1.txt, whose contents are
75 15 85 35 60 50 45 70
Here is my code to read each integer and print them.
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char *argv[])
{
fstream file("f1.txt", ios::in);
int i;
while(!file.eof()) {
file >> i;
cout << i << " ";
}
return 0;...
How can I write a program that will automatically generate an sample examination for example
The user will be prompted to supply four categories of questions to be included in the a 6 question exam from the following list: Loops,Functions,Decisions,Data Types,Built-in functions, Recursion, Algorithms, Top-down design,Objects.
I also ne...
When an attempt to solve the problem
How many seven-element subsets (not repeatable) are there
in a set of nine elements ?
I tried
IEnumerable<string> NineSet =new string[] {"a","b","c","d","e","f","g","h","i"};
var SevenSet =
from first in NineSet
from second in NineSet
where first.CompareTo(second)< 0 && first.Count()...
I have a simple question regarding the Minimax algorithm: for example for the tic-tac-toe game, how do I determine the utility function's for each player plays? It doesn't do that automatically, does it? I must hard-code the values in the game, it can't learn them by itself, does it?
...
I have 3 tables:
Employees T
emp_id | name | address
Department T
dep_id | name
Salaries T
emp_id | dep_id | month | year | salary
For each table, what are the primary keys and the foreign keys?
My answer:
Name of the table | PK | FK|
Employees: emp_id | dep_id
Department: dep_id || emp_id
Salaries: emp_id, dep_id | emp_id,
d...
Hey.
I know how to generate combinations of a set and that's a builtin in Python (what I use), anyway. But how to generate combinations with replacements?
Suppose I have a set with, say, two identical elements - for example, "AABCDE".
Combinations of 3 items could be:
"AAB"
"ABC"
"CDE"
However, the program would count 'ABC' twice - ...
I have a string like this "HelloWorldMyNameIsCarl" and I want it to become something like "Hello_World_My_Name_Is_Carl". How can I do this?
...