It's not something trivial but I would like to know the best way to process multiple outputs, for example:
Input
First line of input will contain a number T = number of test cases. Following...
Type: Posts; User: dotnet13
It's not something trivial but I would like to know the best way to process multiple outputs, for example:
Input
First line of input will contain a number T = number of test cases. Following...
What are you? Einstein of Algo? I don't think so, if you're that good then why you are spending time in a forum, why don't you make a new Programming Language or work for Google/Microsoft? You're not...
I dont know what you are saying, but for a N x M matrix it become O(n log m) since there are N rows and for every row it's log m, if we apply Binary search
that is what I wanted to know, if Im scanning through every element in a list/array the worst case will be O(n) because the element can be at the last position and don't try to confuse me with a...
I know Binary Search has O(log n) complexity because we don't go on checking every values to search like Linear Search. But Im still not sure how O(log n) is calculated for other programs, I mean how...
I'm familiar with most of the algorithm time complexity, but not fully sure about exponential and factorial complexity, I know most of the time recursion takes exponential time but is there any other...
this type of problems are better to solve using dynamic programming technique, it'll also optimize your code in terms of time, try it if you can.
with loop it'll be like this:
int A[5]={1,3,5,7,9}, B[]={2,4,6,8,10}, C[10];
int count=0;
for(int i=0;i<5;i++)
{
Just do a linear search, it's an O(n) time algorithm but will do the work for you, better if you use Binary Search, it has O(log n) complexity and very efficient for large number of input.
can you give a sample input and output so it'll be easy to understand?
char value;
printf_s("enter:");
if (scanf_s("%c", &value) != 1)
{
printf_s("oppppssss \n");
If you to want to create an infinite loop if the input is not 1, then this'll do:
int num;
printf_s("Insert the Value: ");
scanf_s( "%d", &num );
thank you people
Im kinda confused about this brute-force programming thing, can anyone give me a simple example of it?
Thanks a lot, great explanation
Hmm, I see thanks a lot for clear explanation
I see, but how the summation is done?
This is simple recursive solution of Fibonacci number:
int fibo(int n)
{
if(n<=1)
return 1;
else
return fibo(n-1)+fibo(n-2);
}
Ok that makes sense, but what do you mean by [1][5] or [2][5] ? The inner loop suppose to end at [0][4], [1][4], [2][4] because j<5, so 0,1,2,3,4 then exit the inner loop.
a bit more explanation would be appreciated, I mean why the val prints 0 0 0 when it's on top of the inner loop and prints 0 0 -858993460 when printf is after the inner loop, what is going on in the...
I see, but if I put the printf right above the inner loop (top of inner loop) the output becomes 0 0 0, so how the third value becomes part of the array now? I mean arr[3][5]
...
That makes sense, but why the 1st and 2nd value is 0, why not garbage?
int main(void){
int arr[3][5]={ {0,0,0,0,0},
{0,0,0,0,0,},
{0,0,0,0,0,}
};
int i,j,val;
for(i=0; i<3;i++)
1264612647126481264912650