Hi, I was just putting some thought into different languages (as I'm reviewing for final exams coming up) and I can not think of a valid pushdown automata to handle the language A = {0^n 1^n 0^n | n >= 0}. This is not a context-free language, am I correct?
...
I'm writing a simulation for class, and part of it involves the reproduction of organisms. My organisms are kept in an array, and I need to increase the size of the array when they reproduce. Because I have multiple classes for multiple organisms, I used a template:
template <class orgType>
void expandarray(orgType* oldarray, int& numit...
Here's what i have so far...
I have yet to figure out how i'm going to handle the 11 / 1 situation with an ace, and when the player chooses an option for hit/stand, i get segfault.
HELP!!!
updated code
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define DECKSIZE 52
#define VALUE 9
#define FACE 4
#def...
I have 1 function that I want to return the address of an assigned string to the main function and assign an new string pointer with the same address so that the new string will have the contents of the old string.
For example:
unknown_datatype function()
{
char *old = "THE STRING";
return old;
}
int main()
{
ch...
Hi,
For this university project I'm doing (for which I've made a couple of posts in the past), which is some sort of social network, it's required the ability for the users to exchange messages.
At first, I designed my data structures to hold ALL messages in a linked list, limiting the message size to 256 chars. However, I think my ins...
I've searched the forum, and tried to implement the code in the threads I found. But I've been working on this real simple program since about 10am, and can't solve the seg. faults for the life of me.
Any ideas on what I'm doing wrong would be greatly appreciated.
BST.h (All the implementation problems should be in here, and this has ...
I had two separate interfaces, one 'MultiLingual' for choosing language of text to return, and second 'Justification' to justify returned text. Now I need to join them, but I'm stuck at 'java.lang.ClassCastException' error. Class Book is not important here. Data.length and FormattedInt.width correspond to the width of the line. The code ...
To be honest I'm not quite sure if I understand the task myself :) I was told to create class MySimpleIt, that implements Iterator and Iterable and will allow to run the provided test code. Arguments and variables of objects cannot be either Collections or arrays.
The code :
MySimpleIt msi=new MySimple(10,100,
...
Hello, while doing some homework in my very strange C++ book, which I've been told before to throw away, had a very peculiar code segment. I know homework stuff always throws in extra "mystery" to try to confuse you like indenting 2 lines after a single-statement for-loop. But this one I'm confused on because it seems to serve some real-...
Hello everyone:
I am trying to comprehend Perl following the way describe in the book "Minimal Perl".
I've uploaded all source txt files onto my own server : results folder
I got the output from using several bash commands in a "chain" like this:
cat run*.txt | grep '^Bank[[:space:]]Balance'|cut -d ':' -f2 | grep -E '\$[0-9]+'
I kn...
Hi
I am quite new to programming, i have a question please help me. ( this question is java question but i can't remember the syntax but what i write here is mostly it.)
A class Person speaks i am a person
A class Student speaks i am a student
Student extends from Person
Person p = new Student
then what is p speaking then?
...
I have to traverse a matrix and say how many "characteristic areas" of each type it has.
A characteristic area is defined as a zone where elements of value n or >n are adjacent.
For example, given the matrix:
0 1 2 2
0 1 1 2
0 3 0 0
There's a single characteristic area of type 1 which is equal to the original matrix:
0 1 2 2
0 1...
Hello, I am writing a program that is solving the producer/consumer problem, specifically the bounded-buffer version(i believe they mean the same thing). The producer will be generating x number of random numbers, where x is a command line parameter to my program. At the current moment, I believe my program is entering an infinite loop, ...
I'm trying to think up a good hash function for strings. And I was thinking it might be a good idea to sum up the unicode values for the first five characters in the string (assuming it has five, otherwise stop where it ends). Would that be a good idea, or is it a bad one?
I am doing this in Java, but I wouldn't imagine that would mak...
I need to write a program that takes two strings as arguments and check if the second one is a substring of the first one. I need to do it without using any special library functions. I created this implementation, but I think it's always returning true as long as there is one letter that's the same in both strings. Can you help me out h...
Hi I am am trying to complete an assignment, where it is ok to consult the online community. I have to create a graph class that ultimately can do Breadth First Search and Depth First Search. I have been able to implement those algorithms successfully however another requirement is to be able to get the successors and predecessors and ...
My problem isn't with the built-in eval procedure but how to create a simplistic version of it. Just for starters I would like to be able to take this in '(+ 1 2) and have it evaluate the expression + where the quote usually takes off the evaluation.
I have been thinking about this and found a couple things that might be useful:
Unquote...
For a particular piece of homework, I'm implementing a basic data storage system using sequential files under standard C, which cannot load more than 1 record at a time. So, the basic part is creating a new file where the results of whatever we do with the original records are stored. The previous file's renamed, and a new one under the ...
Here is the function description
test($argv)
$argv is an array, for example $argv=array($from1,$to1,$from2,$to2.....);
array items must be even.
$argv=array(1,3,4,5) : this will output values like below:
1_4
1_5
2_4
2_5
3_4
3_5
pseudocode is like
while($from1<=$to1){
while($from2<=$to2){
echo $from1."_".$from2."<br/>"...
how to delete space between two words using c programme... should I use ascii or just compair with ''?
eg. Input- "Hello World" Output-"HelloWorld".
Thanks,
Vikram
...