Skip to content

Commit

Permalink
mt done quick sort assignment complete
Browse files Browse the repository at this point in the history
  • Loading branch information
jasojone committed May 24, 2021
1 parent c77310a commit 7ddc294
Show file tree
Hide file tree
Showing 84 changed files with 4,737 additions and 56 deletions.
Binary file modified cis17cMtP1.1/dist/Debug/Cygwin-Windows/cis17cmtp1.1
Binary file not shown.
12 changes: 8 additions & 4 deletions cis17cMtP10/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ float fg(float);

int main(int argc, char** argv)
{

int x = 1;
cout << fg(x) << endl;

for (int x = -10; x <= 10; x++)
{
cout << "g(" << x / 10.0 << ") = ";
cout << fg(x / 10.0) << endl;
}
return 0;
}

Expand All @@ -36,5 +39,6 @@ float fg(float x)

x /= 2;
float fgx = fg(x);
return (2*fgx) / (1+pow(fgx, 2));
return 2*fgx / (1+pow(fgx, 2));
}

2 changes: 1 addition & 1 deletion cis17cMtP11/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ int main(int argc, char** argv)
{

float x = atan(1);
cout << c(x) << endl;
cout << "x = arctan(1) = " << c(x) << endl;
return 0;
}

Expand Down
4 changes: 3 additions & 1 deletion cis17cMtP11/nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
</data>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
<group>
<file>file:/C:/Users/Jason/OneDrive/Documents/GitHub/Cis17c2021/cis17cMtP11/main.cpp</file>
</group>
</open-files>
</project-private>
4 changes: 1 addition & 3 deletions cis17cMtP12.0/nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
</data>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/Jason/OneDrive/Documents/GitHub/Cis17c2021/cis17cMtP12.0/main.cpp</file>
</group>
<group/>
</open-files>
</project-private>
16 changes: 16 additions & 0 deletions cis17cMtP12.1/cis17cmtp12.1.stackdump
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Stack trace:
Frame Function Args
000FFFFC158 001800637B0 (000FFFFC378, 00000000002, 00000000000, 000FFFFDE50)
000FFFFDE50 001800659AC (00000000064, 00000000000, 0000000012C, 00000000000)
000FFFFC880 001801475E8 (000FFFFC940, 00000000001, 00180171E55, 00000000000)
000FFFFCC40 00180171614 (00000000000, 00000000000, 00000000000, 0018016B268)
000FFFFCC40 001801438EB (00000000000, 000FFFFCB01, 001FC24DFC0, 0018023A780)
000FFFFCC40 00180215F18 (000FFFFCDF0, 00000000000, 0018013E96B, 00000000000)
000FFFFCC40 00180216372 (00F00000000, 0050000004D, 00F00000002, 00800012810)
000FFFFCC40 001800D9B55 (0010000000F, 0000000000A, 00000000000, 000FFFFCCE0)
000FFFFCC40 0018013E96B (0010000000F, 0000000000A, 00000000000, 000FFFFCCE0)
000FFFFCC40 001004010FA (000FFFFCC90, 00180049D60, 00000000000, 00180325BE0)
000FFFFCCE0 0018004AF2D (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFFFF0 00180048886 (00000000000, 00000000000, 00000000000, 00000000000)
000FFFFFFF0 00180048934 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
Binary file modified cis17cMtP12.1/dist/Debug/Cygwin-Windows/cis17cmtp12.1
Binary file not shown.
90 changes: 43 additions & 47 deletions cis17cMtP12.1/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <ctime>//Set the seed
#include <iostream>//I/O
#include <map>
#include <algorithm>

using namespace std;

//No Global Constants
Expand Down Expand Up @@ -58,63 +60,57 @@ int *copy(const int *a,int n){
return b;
}

int *mode(const int *array,int arySize){

//Copy the array
int *ary=copy(array,arySize);
//Sort the ary
mrkSort(ary,arySize);
//Sort the copy
//Find the max Freq
// the key will be the value

int *mode(const int *array,int arySize)
{
map<int,int> m;
int max = 0;
int modCnt = 0;


//you have a for loop that is used to insert values from the arry into the map
//If the value in the arry isnt in the map yet add to made and set its freq to 1 if already
//in map update the freq by one
map<int, int>::itr itr = myMap.find(ary[i]);

int count=0,maxFreq=0;
for(int i=0;i<arySize-1;i++){
if(ary[i]==ary[i+1]){
count++;
if(maxFreq<count)maxFreq=count;
}else{
count=0;
// Add elements from array to map
for(int i = 0; i < arySize; i++)
{
m[array[i]]++;
}

// Get max freq
for (map<int,int>::iterator it=m.begin(); it!=m.end(); ++it)
{
if(max < it->second)
{
max = it->second;
}
}
//Find the number of modes

// for loop find the biggest frequency in the map
// max to find the highest frequency
count=0;
int nModes=0;
for(int i=0;i<arySize-1;i++){
if(ary[i]==ary[i+1]){
count++;
if(maxFreq==count)nModes++;
}else{
count=0;
//Get number of modes
for (map<int,int>::iterator it=m.begin(); it!=m.end(); ++it)
{
if(it->second == max)
{
modCnt++;
}
}

//Allocate the mode array
int *modeAry=new int[nModes+2];
int *modeAry=new int[modCnt+2];

//Show the number of modes
modeAry[0]=modCnt;
modeAry[1]=max;
int idx = 2;

//Fill the mode array
modeAry[0]=nModes;
modeAry[1]=maxFreq+1;
count=0;
int indx=2;
for(int i=0;i<arySize-1;i++){
if(ary[i]==ary[i+1]){
count++;
if(maxFreq==count)modeAry[indx++]=ary[i];
}else{
count=0;
for(int i = 0; i < arySize; ++i)
{
int count = 1;
for (map<int,int>::iterator it=m.begin(); it!=m.end(); ++it)
{
if(it->second == max)
{
modeAry[idx++]=it->first;
}
}
}
//Delete the allocated copy and return
delete []ary;
//Return and terminate
return modeAry;
}

Expand Down
4 changes: 4 additions & 0 deletions cis17cMtP12.1/nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
<activeConfTypeElem>1</activeConfTypeElem>
<activeConfIndexElem>0</activeConfIndexElem>
</data>
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group/>
</open-files>
</project-private>
Binary file modified cis17cMtP3.2/dist/Debug/Cygwin-Windows/cis17cmtp3.2
Binary file not shown.
5 changes: 5 additions & 0 deletions cis17cQuickSort/.dep.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This code depends on make tool being used
DEPFILES=$(wildcard $(addsuffix .d, ${OBJECTFILES} ${TESTOBJECTFILES}))
ifneq (${DEPFILES},)
include ${DEPFILES}
endif
128 changes: 128 additions & 0 deletions cis17cQuickSort/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
#
# There exist several targets which are by default empty and which can be
# used for execution of your targets. These targets are usually executed
# before and after some main targets. They are:
#
# .build-pre: called before 'build' target
# .build-post: called after 'build' target
# .clean-pre: called before 'clean' target
# .clean-post: called after 'clean' target
# .clobber-pre: called before 'clobber' target
# .clobber-post: called after 'clobber' target
# .all-pre: called before 'all' target
# .all-post: called after 'all' target
# .help-pre: called before 'help' target
# .help-post: called after 'help' target
#
# Targets beginning with '.' are not intended to be called on their own.
#
# Main targets can be executed directly, and they are:
#
# build build a specific configuration
# clean remove built files from a configuration
# clobber remove all built files
# all build all configurations
# help print help mesage
#
# Targets .build-impl, .clean-impl, .clobber-impl, .all-impl, and
# .help-impl are implemented in nbproject/makefile-impl.mk.
#
# Available make variables:
#
# CND_BASEDIR base directory for relative paths
# CND_DISTDIR default top distribution directory (build artifacts)
# CND_BUILDDIR default top build directory (object files, ...)
# CONF name of current configuration
# CND_PLATFORM_${CONF} platform name (current configuration)
# CND_ARTIFACT_DIR_${CONF} directory of build artifact (current configuration)
# CND_ARTIFACT_NAME_${CONF} name of build artifact (current configuration)
# CND_ARTIFACT_PATH_${CONF} path to build artifact (current configuration)
# CND_PACKAGE_DIR_${CONF} directory of package (current configuration)
# CND_PACKAGE_NAME_${CONF} name of package (current configuration)
# CND_PACKAGE_PATH_${CONF} path to package (current configuration)
#
# NOCDDL


# Environment
MKDIR=mkdir
CP=cp
CCADMIN=CCadmin


# build
build: .build-post

.build-pre:
# Add your pre 'build' code here...

.build-post: .build-impl
# Add your post 'build' code here...


# clean
clean: .clean-post

.clean-pre:
# Add your pre 'clean' code here...

.clean-post: .clean-impl
# Add your post 'clean' code here...


# clobber
clobber: .clobber-post

.clobber-pre:
# Add your pre 'clobber' code here...

.clobber-post: .clobber-impl
# Add your post 'clobber' code here...


# all
all: .all-post

.all-pre:
# Add your pre 'all' code here...

.all-post: .all-impl
# Add your post 'all' code here...


# build tests
build-tests: .build-tests-post

.build-tests-pre:
# Add your pre 'build-tests' code here...

.build-tests-post: .build-tests-impl
# Add your post 'build-tests' code here...


# run tests
test: .test-post

.test-pre: build-tests
# Add your pre 'test' code here...

.test-post: .test-impl
# Add your post 'test' code here...


# help
help: .help-post

.help-pre:
# Add your pre 'help' code here...

.help-post: .help-impl
# Add your post 'help' code here...



# include project implementation makefile
include nbproject/Makefile-impl.mk

# include project make variables
include nbproject/Makefile-variables.mk
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 7ddc294

Please sign in to comment.