Thank you, sir.
I will look into it.
Regards,
Rajesh V.
User Profile
Collapse
-
RE to NFA
Hello,
I want to code the algorithm to convert a regular expression to NFA. I am aware of the algorithm for the problem. Please give me some ideas for writing an elegant code in C++.
Thank you,
Rajesh V -
Thanks for the nice article. Good encouragement for beginners like me who are afraid of bugs.
there is no substitute for understanding what's going on.
This is my most favourite line of the article.
Thank you,
Rajesh V.Leave a comment:
-
k-element subsets
Hi,
The aim of this C++ code is to print all the k-element subsets of a set of size n. But somewhere it goes wrong - it doesn't print the answer properly. I tried a lot to find the mistake, but in vain. Please help me in debugging it and thanks in advance.
...Code:#include<iostream> #include<vector> using namespace std; int main() { printf( "Enter the number -
Thank you for the counter example. But I think except the input with all the numbers 5, the sum checking should work. The sum checking should be done for all rows, columns, and 3x3 squares.
Thanks again,
Rajesh V...Leave a comment:
-
You can directly check according to the property of a sudoku. Have an array that counts the number of occurrences of each number( 1..9 ). You traverse all the rows. All the columns. And all the 3X3 squares too. For each row, column and a 3X3 sqaure seperately, see that the count value for all the numbers is exactly 1.
I think the following logic might also work. Check whether the sum of all the elements in all rows is 45 and also the...Leave a comment:
-
Array of vectors
We can declare a vector of five 5-element vectors by
Code:vector< vector<int> > v1( 5, vector<int> (5) );
We can declare an array of five empty vectors by
Code:vector<int> v2[5];
But how can we declare an array of five 5-element vectors? -
Evaluation of arguments in function calls
Link to the question
20. main()
{
int i=5;
printf("%d%d%d% d%d%d",i++,i--,++i,--i,i);
}
The output is given as 45545. But I am getting 45555. Please clarify.
In general how to resolve these kind of problems? -
Suggest a good book to learn C++
Hello,
Please suggest a good book to learn C++.
Thank you,
Rajesh V -
Why the GNU compiler gives the warning while using gets() ?
When I use gets() function, the gcc compiler gives the warning - gets function is dangerous and should not be used. What is the problem in using it and how to avoid it ? -
-
Why Java codes take more run time than C/C++ ?
Why Java codes take more run time than C/C++ ? -
In your post, you have said that
won't compile because we need to declare the number of elements.Code:int array[][10];
But, if i do like this,
The compiler gives the error - declaration of ‘a’ as multidimensiona l array must have bounds for all dimensions except the firstCode:int array[10][];
Also, when i do like this,
...Leave a comment:
-
-
Usage of STL is to be made carefully
In C++, while using STL containers, you should think off the time complexity it takes. Don't think that usage of STL always increases the efficiency of your program. As an example, storing values in an array or hashing to an array takes very less time complexity when compared with a map when used instead. It is not that when we start coding in C++ ( that is when we are transformed from C to C++ ), we should replace the arrays by vectors.
...
No activity results to display
Show More
Leave a comment: