Skip to content

Commit

Permalink
p1-3 code complete
Browse files Browse the repository at this point in the history
  • Loading branch information
jasojone committed May 17, 2021
1 parent 1574b70 commit 75873e6
Show file tree
Hide file tree
Showing 47 changed files with 2,305 additions and 225 deletions.
109 changes: 0 additions & 109 deletions cis17cMidTermP4_1.0/main.cpp

This file was deleted.

Binary file modified cis17cMtP1.1/dist/Debug/Cygwin-Windows/cis17cmtp1.1
Binary file not shown.
12 changes: 6 additions & 6 deletions cis17cMtP1.1/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ int main(int argc, char** argv)
srand(static_cast<unsigned int>(time(0)));

//Declare all Variables Here
const int SIZE=80000000;
const int SIZE=100000000;
int *array = new int[SIZE];
int lowRng=0,highRng=SIZE;
int loopCnt = 100000;
int answer = 0;
int loopCnt = 1000000;
int operations = 0;
//double beg = time(0);
//double endd = time(0);
clock_t t;
Expand All @@ -38,7 +38,7 @@ int main(int argc, char** argv)
for(int i = 0; i < loopCnt; ++i)
{
int value=rand()%(highRng-lowRng+1)+lowRng;
answer += binSrch(array,SIZE,value);
operations += binSrch(array,SIZE,value);
}

// End time
Expand All @@ -51,7 +51,7 @@ int main(int argc, char** argv)
//Output
cout<<"Array Size: "<<SIZE<<endl;
cout<<"Loop Count: "<<loopCnt<<endl;
cout<<"Operations: "<<answer / loopCnt<<endl;
cout<<"Operations: "<<operations / loopCnt<<endl;
cout<<"Average Time: "<<time_taken / loopCnt<<" Seconds"<<endl;
// cout<<"Average Time: "<<(endd-beg) / loopCnt<<" Seconds"<<endl;
// cout<<"Average Time: "<<duration.count() / loopCnt<<" Micro Seconds"<<endl;
Expand All @@ -62,7 +62,7 @@ int main(int argc, char** argv)
}
int binSrch(int a[],int n, int val)
{
//Initialize Vars
//Declare the Variables
int lowEnd=0;
int highEnd=n-1;
int ops = 3;
Expand Down
10 changes: 5 additions & 5 deletions cis17cMtP1/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ int main(int argc, char** argv)
srand(static_cast<unsigned int>(time(0)));

//Declare all Variables Here
const int SIZE=1000000;
const int SIZE=2500000;
int *array = new int[SIZE];
int lowRng=0,highRng=SIZE;
int loopCnt = 10000;
int answer = 0;
unsigned long operations = 0;
double beg = time(0);
double endd = time(0);

Expand All @@ -38,7 +38,7 @@ int main(int argc, char** argv)
for(int i = 0; i < loopCnt; ++i)
{
int value=rand()%(highRng-lowRng+1)+lowRng;
answer += linSrch(array,SIZE,value);
operations += linSrch(array,SIZE,value);
}
// End time
endd = time(0);
Expand All @@ -48,7 +48,7 @@ int main(int argc, char** argv)
//Output results
cout<<"Array Size: "<<SIZE<<endl;
cout<<"Loop Count: "<<loopCnt<<endl;
cout<<"Operations: "<<answer / loopCnt<<endl;
cout<<"Operations: "<<operations / loopCnt<<endl;
cout<<"Average Time: "<<(endd-beg) / loopCnt<<" Seconds"<<endl;
cout<<"Average Time: "<<duration.count() / loopCnt<<" Micro Seconds"<<endl;

Expand All @@ -59,7 +59,7 @@ int main(int argc, char** argv)
int linSrch(int a[],int n, int val)
{

int ops = 0;
unsigned long ops = 0;

//Loop until value found
for(int indx=0;indx<n;indx++)
Expand Down
77 changes: 0 additions & 77 deletions cis17cMtP1_1/main.cpp

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 75873e6

Please sign in to comment.