A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/dd/d0d/insertion__sort_8cpp.html below:

TheAlgorithms/C++: sorting/insertion_sort.cpp File Reference

109 {

110 int arr1[10] = {78, 34, 35, 6, 34, 56, 3, 56, 2, 4};

111 std::cout << "Test 1... ";

113 assert(std::is_sorted(arr1, arr1 + 10));

114 std::cout << "passed" << std::endl;

115

116 int arr2[5] = {5, -3, 7, -2, 1};

117 std::cout << "Test 2... ";

119 assert(std::is_sorted(arr2, arr2 + 5));

120 std::cout << "passed" << std::endl;

121

122 float arr3[5] = {5.6, -3.1, -3.0, -2.1, 1.8};

123 std::cout << "Test 3... ";

125 assert(std::is_sorted(arr3, arr3 + 5));

126 std::cout << "passed" << std::endl;

127

128 std::vector<float> arr4({5.6, -3.1, -3.0, -2.1, 1.8});

129 std::cout << "Test 4... ";

131 assert(std::is_sorted(std::begin(arr4), std::end(arr4)));

132 std::cout << "passed" << std::endl;

133

134 int arr5[50];

135 std::cout << "Test 5... ";

138 assert(std::is_sorted(arr5, arr5 + 50));

139 std::cout << "passed" << std::endl;

140

141 float arr6[50];

142 std::cout << "Test 6... ";

145 assert(std::is_sorted(arr6, arr6 + 50));

146 std::cout << "passed" << std::endl;

147}

static void create_random_array(T *arr, int N)

Create a random array objecthelper function to create a random array.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4