src/ucx/array.h

branch
feature/array
changeset 336
6d7aa8a1a3b3
parent 334
bc81faa9afda
child 337
f695ae118460
equal deleted inserted replaced
335:872ae61c8945 336:6d7aa8a1a3b3
274 * @see ucx_array_find() 274 * @see ucx_array_find()
275 */ 275 */
276 int ucx_array_contains(UcxArray array, void *elem, cmp_func cmpfnc, void *data); 276 int ucx_array_contains(UcxArray array, void *elem, cmp_func cmpfnc, void *data);
277 277
278 /** 278 /**
279 * Sorts a UcxArray with natural merge sort. 279 * Sorts a UcxArray with an almost in-place merge sort.
280 * 280 *
281 * This function uses O(n) additional temporary memory for merge operations 281 * This function uses additional memory for exactly one element.
282 * that is automatically freed after each merge.
283 * 282 *
284 * @param the array to sort 283 * @param the array to sort
285 * @param cmpfnc the function that shall be used to compare the element data 284 * @param cmpfnc the function that shall be used to compare the element data
286 * @param data additional data for the cmp_func() 285 * @param data additional data for the cmp_func()
287 * @return zero on success, non-zero if allocation of temporary memory failed 286 */
288 */ 287 void ucx_array_sort(UcxArray array, cmp_func cmpfnc, void *data);
289 int ucx_array_sort(UcxArray array, cmp_func cmpfnc, void *data);
290 288
291 /** 289 /**
292 * Removes an element from the array. 290 * Removes an element from the array.
293 * 291 *
294 * This is in general an expensive operation, because several elements may 292 * This is in general an expensive operation, because several elements may

mercurial