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/d8/dcc/binary__insertion__sort_8cpp.html below:

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

Self-test implementations.

104 {

105

106

107

108 std::vector<int64_t> arr1({5, -3, -1, -2, 7});

109 std::cout << "1st test... ";

111 assert(std::is_sorted(std::begin(arr1), std::end(arr1)));

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

113

114

115

116 std::vector<int64_t> arr2({12, 26, 15, 91, 32, 54, 41});

117 std::cout << "2nd test... ";

119 assert(std::is_sorted(std::begin(arr2), std::end(arr2)));

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

121

122

123

124 std::vector<float> arr3({7.1, -2.5, -4.0, -2.1, 5.7});

125 std::cout << "3rd test... ";

127 assert(std::is_sorted(std::begin(arr3), std::end(arr3)));

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

129

130

131

132 std::vector<float> arr4({12.8, -3.7, -20.7, -7.1, 2.2});

133 std::cout << "4th test... ";

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

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

137}

void insertionSort_binsrch(std::vector< T > &arr)

Insertion sort function to sort the vector.


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