Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
C++
Algorithm 329 codes
Home
C++
Algorithm
1 A function object that computes an integer sum
2 Accumulate value in a vector
3 Accumulate( ) computes a summation of all of the elements within a specified range and returns the result
4 Adjacent_difference
5 Adjacent_difference( ) returns a new sequence in which each element is the difference between adjacent elements in the original
6 Adjacent_find
7 Advance istream_iterator
8 Advance the iterator
9 Algorithm
10 Beginning and Ending Iterators of C-Style Arrays
11 Binary_search a list
12 Calculate sum of elements in a vector
13 Call custom function in for_each
14 Call max() with special comparison function
15 Call min() with special comparison function
16 Check for mismatch between two vectors
17 Combine remove and erase together
18 Combine unique and erase to remove elements if there was a previous greater element
19 Compute the difference
20 Compute the mean float mean with accumulate function
21 Compute the sample standard deviation
22 Computing the sum with template iterators
23 Const_iterator
24 Container includes
25 Convert iterator to reverse iterator
26 Convert to percentages with bind1st and multiplies
27 Copy all letters three elements behind the f
28 Copy and insert list
29 Copy elements from one vector to another vector, removing elements greater than 9 in the process
30 Copy elements in one vector into another vector in reverse order
31 Copy istream_iterator to ostream_iterator
32 Copy only unique elements in a vector into another vector
33 Copy standard input to standard output while compressing spaces
34 Copy vector and list
35 Count true value in a vector
36 Count vowels in a sentence
37 Create a reciprocal function object with transform() and customized function
38 Create a sequence that contains the midpoints between the values in two other sequences
39 Create back_insert_iterator
40 Demonstrate bind2nd()
41 Demonstrate both unary and binary function objects
42 Demonstrate gslice()
43 Demonstrate insert_iterator
44 Demonstrate the two-sequence form of transform()
45 Demonstrating generic find algorithm with an array
46 Demonstrating the generic accumulate algorithm with a reverse iterator
47 Demonstrating the generic merge algorithm with an array, a list, and a deque
48 Determine difference the ranges with set_symmetric_difference()
49 Determine elements in both two sets
50 Determine elements in one set but not in another set
51 Determine elements in set A that are not in set B and elements of set B that are not in set A
52 Determine elements of first range without elements of second range by using set_difference()
53 Determine elements that are in either or both sets
54 Determine whether one set is completely contained in another set
55 Display all elements in a vector
56 Display vector elements using const_iterator
57 Display vector in reverse order using reverse_iterator
58 Displaying a Containers Elements on the Standard Output with copy function
59 Distance for vector
60 Divided contents of a list with transform() and divides()
61 Equal algorithm
62 Equal_range and distance
63 Extends a unary_function
64 Extends unary_function to do sum
65 Find a value in map by key
66 Find all strings that are less than 4 characters long
67 Find an element in a list
68 Find and display sorted v in highest 20th percentile
69 Find and display sorted v in lowest 20th percentile
70 Find and display v in highest 20th percentile
71 Find and display v in lowest 20th percentile
72 Find and print maximum elements in a vector
73 Find and print minimum elements in a vector
74 Find the maximum element in a range in a list
75 Finding the Mean Value
76 Finding the Median
77 Finding the Minimum and Maximum of a Data Type
78 Front_insert_iterator
79 Generate a sequence
80 Generate_n and int sequence
81 Generic find algorithm
82 Generic find algorithm with input iterators associated with io streams
83 Generic merge algorithm
84 Generic merge algorithms
85 Generic mismatch algorithm
86 Get equal range with equal_range
87 Get min and max value from a vector with your won logic
88 Get the distance between two element in a list
89 Illustrate set_intersection
90 Illustrate set_symmetric_difference
91 Illustrate set_union
92 Illustrating the generic accumulate algorithm with predicate
93 Illustrating the generic adjacent_find algorithm
94 Illustrating the generic binary search algorithms
95 Illustrating the generic generate algorithm
96 Illustrating the generic lexicographical_compare algorithm
97 Illustrating the generic next_permutation algorithms
98 Illustrating the generic nth_element algorithm
99 Illustrating the generic prev_permutation algorithms
100 Illustrating the generic swap algorithm
101 Illustrating the generic swap_ranges algorithm
102 Inner_product( ) produces a summation of the product of corresponding elements in two sequences and returns the result
103 Inplace_merge a list
104 Insert_iterator
105 Int sequence
106 Intersect the ranges by using set_intersection()
107 Is string a number
108 Locate first occurrence of a value in a vector
109 Lower_bound and upper_bound
110 Make a sequence starting at -10 and increasing by 100 and sum it with partial_sum
111 Making Consecutive Numbers
112 Map
113 Mem_fun_ref with method from user-defined class
114 Merge a vector with deque
115 Merge in place
116 Merge two containers
117 Merge two ranges within a vector
118 Multiply by 100 to get a percent
119 Negate contents of a list with transform() and negate()
120 Negate for list
121 Negate the contents of result
122 Partial_sum( ) creates a sequence that is a running total of the original sequence
123 Print all elements in a list with copy function
124 Provide predicate for std
125 Provide std
126 Randomize elements in a vector with random_shuffle(scores begin(), scores end())
127 Read all characters while compressing whitespaces
128 Read string from keyboard and save to vector directly
129 Read words from standard input, sort and print out without duplicates
130 Remove adjacent duplicates
131 Remove all instances of 0
132 Remove an element and then erase that element
133 Remove copy Elements if They Meet a Criterion
134 Remove empty string
135 Remove_if for list
136 Removing All Matching Elements
137 Replace value equal to 70 with 42 in a deque
138 Return an iterator from std
139 Return iterator from std
140 Reverse a sequence
141 Reverse the order of the found element with value 3 and all following elements
142 Search first occurrence
143 Search first subrange
144 Select Numbers less than 10
145 Separate even values from the odd ones - even comes first
146 Slice a valarray
147 Sort a heap
148 Sort a string array with sort()
149 Sort a subset of the container
150 Sort a vector and print out the sorted elements
151 Sort a vector into ascending order of id members
152 Sort all element in an array
153 Sort and reverse an int array
154 Sort elements in deque
155 Sort elements reversely with custom function
156 Sort into descending order by using greater
157 Sort objects stored in deque
158 Sort part of the elements in an array
159 Sort random number
160 Sort the entire container
161 Sort vector1 using make_heap and sort_heap
162 Sort vector1 using push_heap and pop_heap
163 Sorting user-defined class
164 Std
165 Subtract the mean from every data point
166 Sum the ranges by using merge()
167 Swap elements at locations 0 and 1 of an array
168 Swap elements in first five elements of an array with elements in last five elements
169 Swap first and second value with iter_swap
170 Swap second and fourth element in a vector
171 Taking the sum of values from a stream
172 Template class for insert iterator for associative containers
173 The generic partial_sort algorithms with predicate
174 The generic stable_sort algorithms with predicate
175 Transform a vector with bind1st and divides
176 Transform all elements into deque from set by multiplying 10
177 Transform with divides
178 Transform, bind2nd and modulus
179 Transform, bind2nd and plus
180 Truncate numbers to fall between 0 and 255 inclusive
181 Unite the ranges by using set_union()
182 Use a binary function object divides
183 Use a binary function object to find the midpoints between elements in v3 and v4 and store the results in v5
184 Use a reverse_iterator to go from the end to the beginning
185 Use accumulate to calculate sum for double array with minus()
186 Use accumulate() and minus()
187 Use adjacent_difference to convert elements in a container into relative values
188 Use assert to check the find method
189 Use back_insert_iterator to insert element into a vector
190 Use binary_search to locate a value in a vector
191 Use const_interator to loop through the set
192 Use copy function to print all elements in a deque
193 Use copy to copy elements in one container to another container
194 Use copy to copy elements of one container into another container in reverse order
195 Use copy to fill values to an array
196 Use copy to output all elements in a container
197 Use count function and print elements with value 4
198 Use count function to count elements that are greater than value 4
199 Use count function to count elements with even value
200 Use count on string
201 Use count() with vector of boolean value
202 Use custom function and for_each to calculate mean value
203 Use custom function and sort to sort strings by length
204 Use equal function to check for corresponding even and odd elements
205 Use equal function to check whether both collections are equal
206 Use equal_range to determine both the lower- and upper-bound insertion points
207 Use fill function to overwrite all elements with again
208 Use fill function to replace the second and up to the last element but one with hmmm
209 Use fill_n function to insert hello nine times
210 Use fill_n function to replace all but two elements with hi
211 Use find algorithm to find an element in a list
212 Use find to search an element in a container
213 Use find_end to search last occurrence of subcoll in coll
214 Use find_end with while loop to find the element
215 Use find_first_of function to search first occurrence of an element
216 Use find_first_of function to search last occurrence of an element
217 Use find_if to find first element divisible by 3
218 Use find_if to find first element greater than 3
219 Use for_each function to add first element to each element in the list
220 Use for_each function to add value for each element
221 Use for_each function to print all elements in a vector
222 Use for_each with predicate
223 Use generate to insert five random numbers into a list
224 Use generate_n to insert five random numbers into a list
225 Use generic adjacent_find algorithm with a predicate to find the first name that is lexicographically greater than the next one.
226 Use generic template function with transform
227 Use Iter with array
228 Use includes and search to check whether all elements in search are also in coll
229 Use includes() function to check if one set contains another set
230 Use includes() to check for subset
231 Use inner_product to calculate inner reverse product
232 Use inner_product to process sum of all products(0 + 11 + 22 + 33 + 44 + 55 + 66)
233 Use inner_product with inner and outer operation
234 Use istream_iterator and find
235 Use istream_iterator to loop through a string
236 Use istream_iterator to loop through a string defined by char pointer
237 Use iterators to swap elements at locations 0 and 1 of an array
238 Use make_heap to convert collection into a heap
239 Use make_pair to insert pair value to a map
240 Use max for char and integer
241 Use max_element to get the maximum element in a container
242 Use max_element with criteria function
243 Use mem_fun_ref to pass in a user-defined member function
244 Use merge with back_inserter
245 Use min for char and integer
246 Use min_element to get the minimum element in a container
247 Use min_element with criteria function
248 Use mismatch function to find the first match
249 Use mismatch function with custom function
250 Use next_permutation to permute elements until they are sorted
251 Use nth_element to extract the four highest elements
252 Use nth_element to extract the four lowest elements
253 Use nth_element with custom function to extract the four highest elements
254 Use numeric_limits to get max value for float, double and long double
255 Use numeric_limits to get max value for short, int and long
256 Use partial_sort to sort all elements
257 Use partial_sort to sort until the first five elements are sorted
258 Use partial_sort with custom function to sort inversely until the first five elements are sorted
259 Use partial_sort_copy to copy elements in one container sorted into another container
260 Use partial_sort_copy with custom comparison function to copy elements in one container sorted into another container
261 Use partial_sum to convert elements in a container into absolute values
262 Use partial_sum to print all partial products
263 Use partial_sum to print all partial sums
264 Use pop_heap to pop next element out of the heap
265 Use predicate in std
266 Use prev_permutation to permute elements until they are sorted in descending order
267 Use prev_permutation to permute until descending sorted
268 Use push_heap to push new element into the heap
269 Use random_shuffle to shuffle all elements randomly
270 Use random_shuffle to shuffle elements with self-written random number generator
271 Use remove_copy to print elements without those having the value 3
272 Use remove_copy_if to copy all elements greater than 3 into a multiset
273 Use remove_copy_if to print elements without those having a value greater than 4
274 Use replace to replace all elements with value 6 with 42
275 Use replace to replace all elements with value less than 5 with 0
276 Use replace_copy to print all elements with value 5 replaced with 55
277 Use replace_copy_if to print all elements with a value less than 5 replaced with 42
278 Use replace_copy_if to print each element while each odd element is replaced with 0
279 Use reverse to reverse order from second to last element but one
280 Use reverse to reverse the order of elements
281 Use reverse_copy to print all of them in reverse order
282 Use rotate to rotate one element to the left
283 Use rotate to rotate so that element with value 4 is the beginning
284 Use rotate to rotate two elements to the right
285 Use rotate_copy to print elements rotated one element to the left
286 Use rotate_copy to print elements rotated so that element with value 4 is the beginning
287 Use rotate_copy to print elements rotated two elements to the right
288 Use search_n to find four consecutive elements with value 3
289 Use search_n with custom function to find four consecutive elements with value greater than 3
290 Use sort_heap to convert heap into a sorted collection(after the call it is no longer a heap)
291 Use sorting criterion in sort function
292 Use stable_partition algorithms
293 Use stable_partition and partition
294 Use std
295 Use swap_ranges to mirror first three with last three elements
296 Use swap_ranges to swap elements in one container with corresponding elements in another container
297 Use the copy algorithms
298 Use the copy_backward algorithms
299 Use the fill_n algorithms
300 Use the generic copy to duplicate vectors
301 Use the generic count algorithm with predicate
302 Use the generic fill algorithms
303 Use the generic remove algorithm
304 Use the generic replace algorithm to replace all occurrences of R by S
305 Use the generic rotate algorithm
306 Use transform function to square all elements in an array
307 Use transform to add each element traversed forward with each element traversed backward
308 Use transform to make the numbers in a list go from a certain range
309 Use transform to negate all elements in a container
310 Use transform to print differences of two corresponding elements
311 Use transform to print elements negatively and in reverse order
312 Use transform to square each element
313 Use transform to transform elements in one container into another container with ten times their value
314 Use unique to remove consecutive duplicates
315 Use unique_copy to copy elements in an array to list with back_inserter
316 Use unique_copy to print elements with consecutive duplicates removed
317 Use unique_copy to print elements without consecutive entries that differ by one
318 Using an in-place generic sort algorithm
319 Using Custom Definitions of the Minimum and Maximum
320 Using find with normal iteration
321 Using numeric_limits Template Class to Calculate Type Ranges
322 Using qsort()
323 Using reverse_copy, a copying version of the generic reverse algorithm
324 Using the generic accumulate algorithm to compute a product by using a function object
325 Using the generic accumulate algorithm to compute a product by using multiplies
326 Using the generic sort algorithm with a binary predicate
327 Using the STL generic reverse algorithm with a vector
328 Whether char is signed
329 Whether numeric limits for type string exist