comparison tests/farray-array.t @ 782:11f3101c1980

farray.sh: Implemented plain Insertionsort. Using the optimized algorithm already used in Shell sort, just without manx gaps and using only the fixed last step 1.
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 26 Oct 2024 18:35:37 +0200
parents 0bb535e50271
children b5b19c62da24
comparison
equal deleted inserted replaced
781:aead7cf1cb9a 782:11f3101c1980
1395 DEBUG: 4: `5' 1395 DEBUG: 4: `5'
1396 $ farray_release TEST 1396 $ farray_release TEST
1397 $ check_no_array_artifacts 1397 $ check_no_array_artifacts
1398 1398
1399 $ farray_create TEST 5 3 2 4 1399 $ farray_create TEST 5 3 2 4
1400 $ farray_heapsort TEST 1400 $ farray_insertionsort TEST
1401 $ check_array_is_sorted "$TEST" 1401 $ check_array_is_sorted "$TEST"
1402 $ farray_debug TEST 1402 $ farray_debug TEST
1403 DEBUG: array `TEST' has length 4 1403 DEBUG: array `TEST' has length 4
1404 DEBUG: the items: 1404 DEBUG: the items:
1405 DEBUG: 1: `2' 1405 DEBUG: 1: `2'
1408 DEBUG: 4: `5' 1408 DEBUG: 4: `5'
1409 $ farray_release TEST 1409 $ farray_release TEST
1410 $ check_no_array_artifacts 1410 $ check_no_array_artifacts
1411 1411
1412 $ farray_create TEST 5 3 2 4 1412 $ farray_create TEST 5 3 2 4
1413 $ farray_heapsort_bottomup TEST 1413 $ farray_heapsort TEST
1414 $ check_array_is_sorted "$TEST" 1414 $ check_array_is_sorted "$TEST"
1415 $ farray_debug TEST 1415 $ farray_debug TEST
1416 DEBUG: array `TEST' has length 4 1416 DEBUG: array `TEST' has length 4
1417 DEBUG: the items: 1417 DEBUG: the items:
1418 DEBUG: 1: `2' 1418 DEBUG: 1: `2'
1420 DEBUG: 3: `4' 1420 DEBUG: 3: `4'
1421 DEBUG: 4: `5' 1421 DEBUG: 4: `5'
1422 $ farray_release TEST 1422 $ farray_release TEST
1423 $ check_no_array_artifacts 1423 $ check_no_array_artifacts
1424 1424
1425 $ farray_create TEST 5 3 2 4
1426 $ farray_heapsort_bottomup TEST
1427 $ check_array_is_sorted "$TEST"
1428 $ farray_debug TEST
1429 DEBUG: array `TEST' has length 4
1430 DEBUG: the items:
1431 DEBUG: 1: `2'
1432 DEBUG: 2: `3'
1433 DEBUG: 3: `4'
1434 DEBUG: 4: `5'
1435 $ farray_release TEST
1436 $ check_no_array_artifacts
1437
1425 $ create_random_array UNSORTED 1000 1438 $ create_random_array UNSORTED 1000
1426 $ check_array_is_sorted "$UNSORTED" 1439 $ check_array_is_sorted "$UNSORTED"
1427 [1] 1440 [1]
1428 1441
1429 $ farray_create TEST 1442 $ farray_create TEST
1430 $ farray_splice "" TEST 1 "" UNSORTED 1443 $ farray_splice "" TEST 1 "" UNSORTED
1431 $ check_array_is_sorted "$TEST" 1444 $ check_array_is_sorted "$TEST"
1432 [1] 1445 [1]
1433 $ farray_gnomesort TEST 1446 $ farray_gnomesort TEST
1447 $ check_array_is_sorted "$TEST"
1448 $ farray_release TEST
1449
1450 $ farray_create TEST
1451 $ farray_splice "" TEST 1 "" UNSORTED
1452 $ check_array_is_sorted "$TEST"
1453 [1]
1454 $ farray_insertionsort TEST
1434 $ check_array_is_sorted "$TEST" 1455 $ check_array_is_sorted "$TEST"
1435 $ farray_release TEST 1456 $ farray_release TEST
1436 1457
1437 $ farray_create TEST 1458 $ farray_create TEST
1438 $ farray_splice "" TEST 1 "" UNSORTED 1459 $ farray_splice "" TEST 1 "" UNSORTED
1943 1964
1944 No Locals 1965 No Locals
1945 ========= 1966 =========
1946 1967
1947 $ check_no_local_artifacts 1968 $ check_no_local_artifacts
1948
1949 $ set