Question: For this lab, we compare a new algorithm for sorting that may be an improvement over Selection Sort. We will check 2 things: The time
For this lab, we compare a new algorithm for sorting that may be an improvement over Selection Sort. We will check 2 things: The time it takes to sort 100,000 integers and the number of instructions it takes to sort 10 integers.
You will need a Stack class: stack.h
stack.cpp
Type in the code in these 2 images:

1) Compile with UNIT_TEST defined and then run with -d yes to see the time it takes in seconds. Report that time in submission box along with the time you found when testing Selection Sort. Which is faster?
2) Compile without UNIT_TEST so we only test with 10 numbers and count how many comparisions are done in this algorithm. (Those are conditional expressions such as <.>, Which does the fewest comparisons?
here is the code typed out
#define CATCH_CONFIG_MAIN #include
template
}; template
#ifndef UNIT_TEST int main () { const int N=10; int x1[N]={1,3,5,6,4,2,8,9,7}; for (auto e: x1) std:: cout s; s.sort(x1,0,N-1); for (auto e: x1) std:: cout
#ifdef UNIT_TEST using Catch:: Matchers::Equals; TEST_CASE ("A fast sort") { const int N=6; int x1[N]= {1,3,5,6,4,2}; int x2[N]={1,2,3,4,5,6}; std :: vector
when I try to compile it, it is giving me errors on line 83, 84
using Catch:: Matchers::Equals; TEST_CASE ("A fast sort")
the errors are
line 83 error: use of undeclared identifier 'Catch'
line 84 error: c++ requires a type specifier for all declarations
line 84 error: expected ';' after top level declarator
How do i fix these problems and the code runs? thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
