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/d13/bubble__sort_8cpp.html below:

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

Self-test implementation.

96 {

97 std::vector<int> vec_1 = {3, 1, -9, 0};

99

100 std::vector<int> vec_2 = {3};

102

103 std::vector<int> vec_3 = {10, 10, 10, 10, 10};

105

106 std::vector<float> vec_4 = {1234, -273.1, 23, 150, 1234, 1555.55, -2000};

108

109 std::vector<char> vec_5 = {'z', 'Z', 'a', 'B', ' ', 'c', 'a'};

111

112 std::vector<std::string> vec_6 = {"Hello", "hello", "Helo", "Hi", "hehe"};

114

115 std::vector<std::pair<int, char>> vec_7 = {{10, 'c'}, {2, 'z'}, {10, 'a'}, {0, 'b'}, {-1, 'z'}};

117

118 assert(std::is_sorted(sorted_1.begin(), sorted_1.end()));

119 assert(std::is_sorted(sorted_2.begin(), sorted_2.end()));

120 assert(std::is_sorted(sorted_3.begin(), sorted_3.end()));

121 assert(std::is_sorted(sorted_4.begin(), sorted_4.end()));

122 assert(std::is_sorted(sorted_5.begin(), sorted_5.end()));

123 assert(std::is_sorted(sorted_6.begin(), sorted_6.end()));

124 assert(std::is_sorted(sorted_7.begin(), sorted_7.end()));

125}

std::vector< T > bubble_sort(std::vector< T > &array)

Bubble sort algorithm.


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