HaiNahi
What is this algorithm analysis
HaiNahi
Engineers don't know coding, they can't write large programs
HaiNahi
Worse in any computer
Alejandro
HaiNahi
If we can't remove a nested loop there is no good to fix others outside
Alejandro
Do you mean engineers or software engineers xD
Anonymous
ninja
HaiNahi
algorithm is any relation between input and output
ninja
you shoud google this type of Que
HaiNahi
O(n ln n)??
ninja
Anonymous
I watched this talk last night, was great so I decide to share it here..
https://youtu.be/9AhS9DuXv00
Ehsan
HaiNahi
I was thinking what if I write program for any much fast computer
HaiNahi
infinitely fast
HaiNahi
What could we do with that, rather than compressing files
HaiNahi
When we would compress a large program, the code of it would generate, which is perfectly small, may be smaller than the real code, magically
ninja
can i say dead man walking😂😂
HaiNahi
HaiNahi
What if we write, and that would be pure IQ there is no engineer who can make it faster
HaiNahi
My question is if such a computer comes in the world, could we bring a revolution
HaiNahi
If we can make intelligence out of it, that would mean intelligence is mathematical rather than evolution
Ehsan
ninja
数学の恋人
oh come on I can't put a screenshot now?
数学の恋人
anyways, I'm trying something like,
inline Types::Byte Mem::operator[](Types::DWord address) const {
// asserting that the address is always less than MAX_MEM
assert(address <= MAX_MEM);
return Data[address]; // Here I am getting a warning, which suggests me to use gsl::at()
}
数学の恋人
B S
I want to find factor of any no.
Input 4
Output
3
1 2 4
B S
How can I print numbers of factor?
B S
Int n;
Cin>>n;
for(int i=0;i<=n;i++){
if(n%i==0){
cout<<i<<" ";
}
}
B S
I want to find factor to any no.
Example
Input 4
Output 3
B S
Please help me some one
B S
Anonymous
See this example
Why? Code to find factors in every languages is everywhere on the net...
B S
Anonymous
Anonymous
What did u search for?
B S
Factor of 4
Is 1 ,2 ,4
I want to print 3 as answer number
B S
How to find no of factors?
Anonymous
Then u get math answers i suppose?
B S
No
I got whole code but I did not get my desired output
B S
Factor of 4
Is 1 ,2 ,4
I want to print 3 as answer number
B S
Anonymous
This
U know u can add a variable for counter and add 1 to it for every factor... just saying
Anonymous
Or refine the google term :)
数学の恋人
数学の恋人
or nvm, I'll google
数学の恋人
there is not such thing lol
it's for vectors and dynamic iterator tyeps
olli
数学の恋人
olli
yeah got you
unfortunately your example does not show the type of Data, but if it is an array/Container/.. you can do return gsl::at(array, index);
Or you could disable the warning if your code makes sure not to access data out of bounds.
@𝑺𝒐𝒃𝒌𝒂
#cs50
Brian
#include <iostream>
using namespace std;
int sumoftotal (int A[],int size)
{
int sum=0,i;
for(i=0;i<size;i++)
{
sum+=A[i];
}
return sum;
}
float mean(int *A,int size)
{
int i;
float sum=0;
float avg;
for(i=0;i<size;i++)
{
sum+=A[i];
}
avg=sum/10;
return avg;
}
int big(int *A,int size)
{
int large,i;
large=A[0];
for(i=1;i<size;i++)
{
if(A[i]>large)
large=A[i];
}
return large;
}
int low(int *A,int size)
{
int small,i;
small=A[0];
for(i=1;i<size;i++)
{
if(A[i]<small)
small=A[i];
}
return small;
}
int main()
{
int A[10],i,large,small,a;
a:
int size=sizeof(A)/sizeof(A[0]);
cout<<"Enter marks of ten subjects: ";
for(i=0;i<size;i++)
{
cin>>A[i];
if(A[i]>=0 && A[i]<=100)
{
continue;
}
system("cls");
cout<<" input value not in range [0-100]"<<endl;
goto a;
}
int total=sumoftotal(A,size);
cout<<"the total is "<<total<<endl;
float avarage=mean(A,size);
cout<<"avarage is "<<avarage<<endl;
if(avarage>70)
{
cout<<"Grade is A "<<endl;
}
else if(avarage>=60 && avarage<=69)
{
cout<<"Grade is B "<<endl;
}
else if(avarage>=50 && avarage <=59)
{
cout<<"Grade is c "<<endl;
}
else if(avarage>=40 && avarage<=49)
{
cout<<"Grade is c "<<endl;
}
else
{
cout<<"Grade is F"<<endl;
}
int ttl=big(A,size);
int tss=low(A,size);
cout<<"smallest mark "<<tss<<endl;
cout<<"largest mark "<<ttl<<endl;
return 0;
}
Brian
#include <iostream>
using namespace std;
int sumoftotal (int A[],int size)
{
int sum=0,i;
for(i=0;i<size;i++)
{
sum+=A[i];
}
return sum;
}
float mean(int *A,int size)
{
int i;
float sum=0;
float avg;
for(i=0;i<size;i++)
{
sum+=A[i];
}
avg=sum/10;
return avg;
}
int big(int *A,int size)
{
int large,i;
large=A[0];
for(i=1;i<size;i++)
{
if(A[i]>large)
large=A[i];
}
return large;
}
int low(int *A,int size)
{
int small,i;
small=A[0];
for(i=1;i<size;i++)
{
if(A[i]<small)
small=A[i];
}
return small;
}
int main()
{
int A[10],i,large,small,a;
a:
int size=sizeof(A)/sizeof(A[0]);
cout<<"Enter marks of ten subjects: ";
for(i=0;i<size;i++)
{
cin>>A[i];
if(A[i]>=0 && A[i]<=100)
{
continue;
}
system("cls");
cout<<" input value not in range [0-100]"<<endl;
goto a;
}
int total=sumoftotal(A,size);
cout<<"the total is "<<total<<endl;
float avarage=mean(A,size);
cout<<"avarage is "<<avarage<<endl;
if(avarage>70)
{
cout<<"Grade is A "<<endl;
}
else if(avarage>=60 && avarage<=69)
{
cout<<"Grade is B "<<endl;
}
else if(avarage>=50 && avarage <=59)
{
cout<<"Grade is c "<<endl;
}
else if(avarage>=40 && avarage<=49)
{
cout<<"Grade is c "<<endl;
}
else
{
cout<<"Grade is F"<<endl;
}
int ttl=big(A,size);
int tss=low(A,size);
cout<<"smallest mark "<<tss<<endl;
cout<<"largest mark "<<ttl<<endl;
return 0;
}
Accepts 10 marks,find total, avarage, grade it, display the highest and lowest marks, doesn't accept any mark out of range of (0-100)
Brian
Anonymous
Anonymous
Brian
Anonymous
asterix
Hi
Is there some way to get source code of c as like we can get for php or other language.
I want to know internals of preprocessor
klimi
you can get for example the source code of gcc
klimi