Mon Sep 12 07:56:37 2022 combo_test(): Python version: 3.6.9 Test combo(). backtrack_test(): backtrack() supervises a backtrack search. We demonstrate by searching for a nonattacking arrangement of queens on a chessboard. 8 4 1 3 6 2 7 5 8 3 1 6 2 5 7 4 8 2 5 3 1 7 4 6 8 2 4 1 7 5 3 6 7 5 3 1 6 8 2 4 7 4 2 8 6 1 3 5 7 4 2 5 8 1 3 6 7 3 8 2 5 1 6 4 7 3 1 6 8 5 2 4 7 2 6 3 1 4 8 5 7 2 4 1 8 5 3 6 7 1 3 8 6 4 2 5 6 8 2 4 1 7 5 3 6 4 7 1 8 2 5 3 6 4 7 1 3 5 2 8 6 4 2 8 5 7 1 3 6 4 1 5 8 2 7 3 6 3 7 4 1 8 2 5 6 3 7 2 8 5 1 4 6 3 7 2 4 8 1 5 6 3 5 8 1 4 2 7 6 3 5 7 1 4 2 8 6 3 1 8 5 2 4 7 6 3 1 8 4 2 7 5 6 3 1 7 5 8 2 4 6 2 7 1 4 8 5 3 6 2 7 1 3 5 8 4 6 1 5 2 8 3 7 4 5 8 4 1 7 2 6 3 5 8 4 1 3 6 2 7 5 7 4 1 3 8 6 2 5 7 2 6 3 1 8 4 5 7 2 6 3 1 4 8 5 7 2 4 8 1 3 6 5 7 1 4 2 8 6 3 5 7 1 3 8 6 4 2 5 3 8 4 7 1 6 2 5 3 1 7 2 8 6 4 5 3 1 6 8 2 4 7 5 2 8 1 4 7 3 6 5 2 6 1 7 4 8 3 5 2 4 7 3 8 6 1 5 2 4 6 8 3 1 7 5 1 8 6 3 7 2 4 5 1 8 4 2 7 3 6 5 1 4 6 8 2 7 3 4 8 5 3 1 7 2 6 4 8 1 5 7 2 6 3 4 8 1 3 6 2 7 5 4 7 5 3 1 6 8 2 4 7 5 2 6 1 3 8 4 7 3 8 2 5 1 6 4 7 1 8 5 2 6 3 4 6 8 3 1 7 5 2 4 6 8 2 7 1 3 5 4 6 1 5 2 8 3 7 4 2 8 6 1 3 5 7 4 2 8 5 7 1 3 6 4 2 7 5 1 8 6 3 4 2 7 3 6 8 5 1 4 2 7 3 6 8 1 5 4 2 5 8 6 1 3 7 4 1 5 8 6 3 7 2 4 1 5 8 2 7 3 6 3 8 4 7 1 6 2 5 3 7 2 8 6 4 1 5 3 7 2 8 5 1 4 6 3 6 8 2 4 1 7 5 3 6 8 1 5 7 2 4 3 6 8 1 4 7 5 2 3 6 4 2 8 5 7 1 3 6 4 1 8 5 7 2 3 6 2 7 5 1 8 4 3 6 2 7 1 4 8 5 3 6 2 5 8 1 7 4 3 5 8 4 1 7 2 6 3 5 7 1 4 2 8 6 3 5 2 8 6 4 7 1 3 5 2 8 1 7 4 6 3 1 7 5 8 2 4 6 2 8 6 1 3 5 7 4 2 7 5 8 1 4 6 3 2 7 3 6 8 5 1 4 2 6 8 3 1 4 7 5 2 6 1 7 4 8 3 5 2 5 7 4 1 8 6 3 2 5 7 1 3 8 6 4 2 4 6 8 3 1 7 5 1 7 5 8 2 4 6 3 1 7 4 6 8 2 5 3 1 6 8 3 7 4 2 5 1 5 8 6 3 7 2 4 bal_seq_check_test(): bal_seq_check() checks N and T(1:2*N). Check? N T(1:2*N) 1 5 0 0 1 0 1 0 5 1 1 0 1 0 0 5 0 0 1 0 1 bal_seq_enum_test(): bal_seq_enum() enumerates balanced sequences of N terms. N # 0 1 1 1 2 2 3 5 4 14 5 42 6 132 7 429 8 1430 9 4862 10 16796 bal_seq_rank_test(): bal_seq_rank() ranks balanced sequences of N items. The element to be ranked is: 0 0 1 0 1 1 0 0 1 1 Computed rank: 21 bal_seq_successor_test(): bal_seq_successor() lists balanced sequences of N items, one at a time. 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 1 0 0 0 0 1 1 1 0 1 1 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 1 0 0 0 1 0 1 1 0 1 1 0 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 1 1 0 1 0 1 1 0 0 0 1 1 0 1 1 0 1 0 0 0 1 1 1 0 0 1 1 0 0 0 1 1 1 0 1 0 1 0 0 1 0 0 0 1 1 1 1 0 0 1 0 0 1 0 1 1 1 0 0 1 0 0 1 1 0 1 1 0 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 0 1 0 1 1 0 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 0 1 1 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 0 1 1 0 0 1 0 1 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 0 0 0 1 1 1 0 1 0 1 0 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 1 1 1 0 1 0 1 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 bal_seq_to_tableau_test(): bal_seq_to_tableau() converts a balanced sequence to a tableau Balanced sequence: 0 0 1 1 0 0 1 1 tableau: Col: 0 1 2 3 Row 0: 1 2 5 6 1: 3 4 7 8 bal_seq_unrank_test(): bal_seq_unrank() unranks a balanced sequence of N items. Rank = 21 The element of that rank is: 0 0 1 0 1 1 0 0 1 1 bell_numbers_test(): bell_numbers() computes Bell numbers. 0 1 1 1 1 1 2 2 2 3 5 5 4 15 15 5 52 52 6 203 203 7 877 877 8 4140 4140 9 21147 21147 10 115975 115975 bell_values_test(): bell_values() returns values of the Bell numbers. N BELL(N) 0 1 1 1 2 2 3 5 4 15 5 52 6 203 7 877 8 4140 9 21147 10 115975 cycle_check_test(): cycle_check() checks a permutation in cycle form. Permutation in cycle form: Number of cycles is 3 5 1 3 8 6 2 4 7 Check = 0 Permutation in cycle form: Number of cycles is 0 Check = 0 Permutation in cycle form: Number of cycles is 3 5 1 3 8 6 2 4 Check = 0 Permutation in cycle form: Number of cycles is 3 5 1 3 12 6 2 4 7 Check = 0 Permutation in cycle form: Number of cycles is 3 5 1 3 8 5 2 4 7 Check = 0 Permutation in cycle form: Number of cycles is 3 5 1 3 8 6 2 4 7 Check = 1 cycle_to_perm_test(): cycle_to_perm() converts a permutation from cycle to array form. Permutation in cycle form: Number of cycles is 3 4 2 5 3 1 6 7 Corresponding permutation form: 1 2 3 4 5 6 7 4 5 1 2 3 6 7 dist_enum_test(): dist_enum() enumerates distributions of N indistinguishable objects among M distinguishable slots: N: 0 1 2 3 4 5 M 0: 0 0 0 0 0 0 1: 1 1 1 1 1 1 2: 1 2 3 4 5 6 3: 1 3 6 10 15 21 4: 1 4 10 20 35 56 5: 1 5 15 35 70 126 6: 1 6 21 56 126 252 7: 1 7 28 84 210 462 8: 1 8 36 120 330 792 9: 1 9 45 165 495 1287 10: 1 10 55 220 715 2002 dist_next_test(): dist_next() produces the "next" distribution of M indistinguishable objects among K distinguishable slots: Number of: indistinguishable objects = 5 distinguishable slots = 3 distributions is 21 1: 0 0 5 2: 0 1 4 3: 0 2 3 4: 0 3 2 5: 0 4 1 6: 0 5 0 7: 1 0 4 8: 1 1 3 9: 1 2 2 10: 1 3 1 11: 1 4 0 12: 2 0 3 13: 2 1 2 14: 2 2 1 15: 2 3 0 16: 3 0 2 17: 3 1 1 18: 3 2 0 19: 4 0 1 20: 4 1 0 21: 5 0 0 edge_check_test(): edge_check() checks a graph described by edges. Check? Nodes Edges EdgeList 0 -5 3 Edge list of graph: Col: 0 1 2 Row 0: 1 2 3 1: 2 3 1 0 3 -1 Edge list of graph: (None) 0 3 3 Edge list of graph: Col: 0 1 2 Row 0: 1 2 3 1: 2 3 4 0 3 3 Edge list of graph: Col: 0 1 2 Row 0: 1 2 3 1: 2 2 1 0 3 3 Edge list of graph: Col: 0 1 2 Row 0: 1 2 2 1: 2 3 1 1 3 3 Edge list of graph: Col: 0 1 2 Row 0: 1 2 3 1: 2 3 1 edge_degree_test(): edge_degree() determines the degree of each node in a graph. The edge array: Col: 0 1 2 3 4 Row 0: 1 2 2 3 4 1: 2 3 4 4 5 The degree vector: 0 1 1 3 2 2 3 3 4 1 edge_enum_test(): edge_enum() enumerates the maximum number of edges possible in a graph of NODE_NUM nodes. NODE_NUM edge_NUM(max) 1 0 2 1 3 3 4 6 5 10 6 15 7 21 8 28 9 36 10 45 gray_code_check_test(): gray_code_check() checks N and T(1:N). Check? N T(1:N) True 5: 0 1 1 0 1 False 5: 1 0 7 1 0 True 5: 1 1 1 1 1 gray_code_enum_test(): gray_code_enum() enumerates Gray codes on N elements. N Enum(N) 0 1 1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024 gray_code_random_test(): gray_code_random() returns a random Gray code of N digits. [1 0 1 1 1 0] [0 1 1 1 0 0] [0 0 0 1 1 0] [1 1 1 1 0 0] [0 1 1 1 0 1] [1 1 0 1 0 1] [0 0 1 1 0 0] [0 1 0 1 0 0] [0 0 0 0 0 0] [0 0 1 1 1 1] gray_code_rank_test(): gray_code_rank() ranks a given Gray code. Element to be ranked: 0 1 1 1 2 0 3 0 4 0 Computed rank: 16 gray_code_successor_test: gray_code_successor returns the next Gray code. 0: 0 0 0 0 0 1: 0 0 0 0 1 2: 0 0 0 1 1 3: 0 0 0 1 0 4: 0 0 1 1 0 5: 0 0 1 1 1 6: 0 0 1 0 1 7: 0 0 1 0 0 8: 0 1 1 0 0 9: 0 1 1 0 1 10: 0 1 1 1 1 11: 0 1 1 1 0 12: 0 1 0 1 0 13: 0 1 0 1 1 14: 0 1 0 0 1 15: 0 1 0 0 0 16: 1 1 0 0 0 17: 1 1 0 0 1 18: 1 1 0 1 1 19: 1 1 0 1 0 20: 1 1 1 1 0 21: 1 1 1 1 1 22: 1 1 1 0 1 23: 1 1 1 0 0 24: 1 0 1 0 0 25: 1 0 1 0 1 26: 1 0 1 1 1 27: 1 0 1 1 0 28: 1 0 0 1 0 29: 1 0 0 1 1 30: 1 0 0 0 1 31: 1 0 0 0 0 gray_code_unrank_test(): gray_code_unrank() unranks a Gray code. Seek the element of rank 16 The item of the given rank 0 1 1 1 2 0 3 0 4 0 i4_fall_test(): i4_fall() evaluates the falling factorial Fall(I,N). M N Exact i4_fall(M,N) 5 0 1 1 5 1 5 5 5 2 20 20 5 3 60 60 5 4 120 120 5 5 120 120 5 6 0 0 50 0 1 1 10 1 10 10 4000 1 4000 4000 10 2 90 90 18 3 4896 4896 4 4 24 24 98 3 912576 912576 1 7 0 0 i4_fall_values_test: i4_fall_values returns values of the integer falling factorial. M N i4_fall(M,N) 5 0 1 5 1 5 5 2 20 5 3 60 5 4 120 5 5 120 5 6 0 50 0 1 10 1 10 4000 1 4000 10 2 90 18 3 4896 4 4 24 98 3 912576 1 7 0 i4_huge_test(): i4_huge() returns a huge integer. i4_huge() = 2147483647 i4mat_print_test: Test i4mat_print, which prints an I4MAT. A 5 x 6 integer matrix: Col: 0 1 2 3 4 Row 0: 11 12 13 14 15 1: 21 22 23 24 25 2: 31 32 33 34 35 3: 41 42 43 44 45 4: 51 52 53 54 55 Col: 5 Row 0: 16 1: 26 2: 36 3: 46 4: 56 i4mat_print_some_test(): i4mat_print_some() prints some of an I4MAT. Here is I4MAT, rows 0:2, cols 3:5: Col: 3 4 5 Row 0: 14 15 16 1: 24 25 26 2: 34 35 36 i4vec_backtrack_test(): i4vec_backtrack() uses backtracking, seeking a vector X of N values which satisfies some condition. In this demonstration, we have 8 integers W(I). We seek all subsets that sum to 53. X(I) is 0 or 1 if the entry is skipped or used. 1 53: 15 22 16 2 53: 15 14 16 8 3 53: 22 14 9 8 Done! i4vec_dot_product_test(): i4vec_dot_product() computes the dot product of two I4VECs. The vector A: 0 6 1 4 2 7 3 0 4 0 The vector B: 0 4 1 7 2 7 3 0 4 7 The dot product is 101 i4vec_indicator1_test(): i4vec_indicator1() returns an indicator vector. The indicator1 vector: 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 i4vec_part1_test: i4vec_part1 partitions an integer N into NPART parts. Partition N = 17 into NPART = 5 parts: 0 13 1 1 2 1 3 1 4 1 i4vec_part2_test: i4vec_part2 partitions an integer N into NPART parts. Partition N = 17 into NPART = 5 parts: 0 4 1 4 2 3 3 3 4 3 i4vec_print_test(): i4vec_print() prints an I4VEC. Here is an I4VEC: 0 91 1 92 2 93 3 94 i4vec_reverse_test() i4vec_reverse() reverses a list of integers. Original vector: 0 0 1 11 2 23 3 8 4 8 5 14 6 9 7 17 8 22 9 5 Reversed: 0 5 1 22 2 17 3 9 4 14 5 8 6 8 7 23 8 11 9 0 i4vec_search_binary_a_test(): i4vec_search_binary_a() searches a ascending sorted vector. Ascending sorted array: 0 0 1 1 2 1 3 2 4 3 5 4 6 5 7 6 8 7 9 8 Now search for an instance of the value 5 The value occurs at index = 6 i4vec_search_binary_d_test(): i4vec_search_binary_d() searches a descending sorted vector. Descending sorted array: 0 8 1 7 2 6 3 5 4 4 5 3 6 2 7 1 8 1 9 0 Now search for an instance of the value 5 The value occurs at index = 3 i4vec_sort_insert_a_test(): i4vec_sort_insert_a() sorts an integer array. Unsorted array: 0 3 1 8 2 10 3 7 4 2 5 6 6 3 7 2 8 10 9 5 Sorted array: 0 2 1 2 2 3 3 3 4 5 5 6 6 7 7 8 8 10 9 10 i4vec_sort_insert_d_test(): i4vec_sort_insert_d() descending sorts an I4VEC. Unsorted array: 0 5 1 4 2 10 3 9 4 4 5 5 6 10 7 1 8 2 9 4 Descending sorted array: 0 10 1 10 2 9 3 5 4 5 5 4 6 4 7 4 8 2 9 1 knapsack_01_test(): knapsack_01() solves the 0/1 knapsack problem. Object, Profit, Mass, "Profit Density" 0 24.000 12.000 2.000 1 13.000 7.000 1.857 2 23.000 11.000 2.091 3 15.000 8.000 1.875 4 16.000 9.000 1.778 After reordering by Profit Density: Object, Profit, Mass, "Profit Density" 0 23.000 11.000 2.091 1 24.000 12.000 2.000 2 15.000 8.000 1.875 3 13.000 7.000 1.857 4 16.000 9.000 1.778 Total mass restriction is 26.000000 Object, Density, Choice, Profit, Mass 0 2.091 1.000 23.000 11.000 1 2.000 0.000 0.000 0.000 2 1.875 1.000 15.000 8.000 3 1.857 1.000 13.000 7.000 4 1.778 0.000 0.000 0.000 Total: 51.000 26.000 knapsack_rational_test(): knapsack_rational() solves the rational knapsack problem. Object, Profit, Mass, "Profit Density" 0 24.000 12.000 2.000 1 13.000 7.000 1.857 2 23.000 11.000 2.091 3 15.000 8.000 1.875 4 16.000 9.000 1.778 After reordering by Profit Density: Object, Profit, Mass, "Profit Density" 0 23.000 11.000 2.091 1 24.000 12.000 2.000 2 15.000 8.000 1.875 3 13.000 7.000 1.857 4 16.000 9.000 1.778 Total mass restriction is 26.000000 Object, Density, Choice, Profit, Mass 0 2.091 1.000 23.000 11.000 1 2.000 1.000 24.000 12.000 2 1.875 0.375 5.625 3.000 3 1.857 0.000 0.000 0.000 4 1.778 0.000 0.000 0.000 Total: 52.625 26.000 knapsack_reorder_test(): knapsack_reorder() reorders knapsack data. Object, Profit, Mass, "Profit Density" 0 24.000 12.000 2.000 1 13.000 7.000 1.857 2 23.000 11.000 2.091 3 15.000 8.000 1.875 4 16.000 9.000 1.778 After reordering by Profit Density: Object, Profit, Mass, "Profit Density" 0 23.000 11.000 2.091 1 24.000 12.000 2.000 2 15.000 8.000 1.875 3 13.000 7.000 1.857 4 16.000 9.000 1.778 ksubset_colex_check_test(): ksubset_colex_check() checks a K subset of an N set. Subset:(empty vector) N = 5, K = -1 Check = False Subset: 5 3 2 N = 0, K = 3 Check = False Subset: 5 2 3 N = 5, K = 3 Check = False Subset: 7 3 2 N = 5, K = 3 Check = False Subset: 5 3 2 N = 5, K = 3 Check = True Subset:(empty vector) N = 5, K = 0 Check = True Subset:(empty vector) N = 0, K = 0 Check = True ksubset_colex_rank_test(): ksubset_colex_rank() ranks K-subsets of an N set, using the colexicographic ordering. The element to be ranked: 5 3 1 The rank of the element is computed as 5. ksubset_colex_successor_test(): ksubset_colex_successor() lists K-subsets of an N set, using the colexicographic ordering. 3 2 1 4 2 1 4 3 1 4 3 2 5 2 1 5 3 1 5 4 1 5 4 2 5 4 3 ksubset_colex_unrank_test(): ksubset_colex_unrank() unranks K-subsets of an N set, using the colexicographic ordering: The element of rank 5: The element: 0 5 1 3 2 1 ksubset_enum_test(): ksubset_enum() enumerates K-subsets of an N set. K: 0 1 2 3 4 5 N 0: 1 1: 1 1 2: 1 2 1 3: 1 3 3 1 4: 1 4 6 4 1 5: 1 5 10 10 5 1 ksubset_lex_check_test(): ksubset_lex_check() checks a K subset of an N set. Subset:(empty vector) N = %d, K = %d (5, -1) Check = False Subset: 2 3 5 N = %d, K = %d (0, 3) Check = False Subset: 3 2 5 N = %d, K = %d (5, 3) Check = False Subset: 2 3 7 N = %d, K = %d (5, 3) Check = False Subset: 2 3 5 N = %d, K = %d (5, 3) Check = True Subset:(empty vector) N = %d, K = %d (5, 0) Check = True Subset:(empty vector) N = %d, K = %d (0, 0) Check = True ksubset_lex_rank_test(): ksubset_lex_rank() ranks K-subsets of an N set, using the lexicographic ordering. The element to be ranked: 1 4 5 The rank is computed as 5. ksubset_lex_successor_test(): ksubset_lex_successor() lists K-subsets of an N set, using the lexicographic ordering. 1 2 3 1 2 4 1 2 5 1 3 4 1 3 5 1 4 5 2 3 4 2 3 5 2 4 5 3 4 5 ksubset_lex_unrank_test(): ksubset_lex_unrank() unranks K-subsets of an N set, using the lexicographic ordering. The element of rank 5: 1 4 5 ksubset_revdoor_rank_test(): ksubset_revdoor_rank() ranks K-subsets of an N set using the revolving door ordering. The K-subset to be ranked: 2 4 5 The rank of the element is computed as 4 ksubset_revdoor_successor_test(): ksubset_revdoor_successor() lists K-subsets of an N set using the revolving door ordering. 1 2 3 1 3 4 2 3 4 1 2 4 1 4 5 2 4 5 3 4 5 1 3 5 2 3 5 1 2 5 ksubset_revdoor_unrank_test(): ksubset_revdoor_unrank() unranks K-subsets of an N set using the revolving door ordering. The element of rank 5: 2 4 5 marriage_test(): marriage() arranges a set of stable marriages given a set of preferences. Man, Wife's rank, Wife 1 3 1 2 4 4 3 3 5 4 2 3 5 3 2 Woman, Husband's rank, Husband 1 2 1 2 2 5 3 2 4 4 2 2 5 3 3 Correct result: M:W 1 2 3 4 5 1 + . . . . 2 . . . + . 3 . . . . + 4 . . + . . 5 . + . . . mountain_test(): mountain() computes mountain numbers. Y MXY 0 42 0 14 0 5 0 2 0 1 0 1 1 0 42 0 14 0 5 0 2 0 1 0 2 90 0 28 0 9 0 3 0 1 0 0 3 0 48 0 14 0 4 0 1 0 0 0 4 75 0 20 0 5 0 1 0 0 0 0 5 0 27 0 6 0 1 0 0 0 0 0 npart_enum_test(): npart_enum() enumerates partitions of N into part_NUM parts. part_NUM: 1 2 3 4 5 6 N 0: 1: 1 2: 1 1 3: 1 1 1 4: 1 2 1 1 5: 1 2 2 1 1 6: 1 3 3 2 1 1 7: 1 3 4 3 2 1 8: 1 4 5 5 3 2 9: 1 4 7 6 5 3 10: 1 5 8 9 7 5 npart_rsf_lex_random_test(): npart_rsf_lex_random() produces random examples of partitions of N = 12 with NPART = 3 parts in reverse standard form. 1 4 7 3 4 5 1 5 6 4 4 4 2 5 5 2 5 5 2 3 7 4 4 4 2 3 7 3 4 5 npart_rsf_lex_rank_test(): npart_rsf_lex_rank() ranks partitions of N with NPART parts in reverse standard form. Element: 1 5 6 The rank of the element is computed as 4: npart_rsf_lex_successor_test(): npart_rsf_lex_successor() lists partitions of N with NPART parts in reverse standard form. 1 1 10 1 2 9 1 3 8 1 4 7 1 5 6 2 2 8 2 3 7 2 4 6 2 5 5 3 3 6 3 4 5 4 4 4 npart_rsf_lex_unrank_test(): npart_rsf_lex_unrank() unranks partitions of N with NPART parts in reverse standard form. The element of rank 4: 1 5 6 npart_sf_lex_successor_test(): npart_sf_lex_successor() lists Partitions of N with NPART parts in standard form. For N = 12 and NPART = 3 the number of partitions is 12 4 4 4 5 4 3 5 5 2 6 3 3 6 4 2 6 5 1 7 3 2 7 4 1 8 2 2 8 3 1 9 2 1 10 1 1 npart_table_test(): npart_table() tabulates partitions of N with NPART parts I P(I,0) P(I,1) P(I,2) P(I,3) P(I,4) P(I,5) 0 1 0 0 0 0 0 1 0 1 0 0 0 0 2 0 1 1 0 0 0 3 0 1 1 1 0 0 4 0 1 2 1 1 0 5 0 1 2 2 1 1 6 0 1 3 3 2 1 7 0 1 3 4 3 2 8 0 1 4 5 5 3 9 0 1 4 7 6 5 10 0 1 5 8 9 7 part_enum_test(): part_enum() enumerates partitions of N. N # 0 1 1 1 2 2 3 3 4 5 5 8 6 11 7 15 8 22 9 30 10 42 part_rsf_check_test(): part_rsf_check() checks a reverse standard form partition. Partition in RSF form. Partition of N = 0 Number of parts NPART = 4 1 4 4 6 Check = False Partition in RSF form. Partition of N = 15 Number of parts NPART = 0 (empty vector) Check = False Partition in RSF form. Partition of N = 15 Number of parts NPART = 4 -9 4 4 16 Check = False Partition in RSF form. Partition of N = 15 Number of parts NPART = 4 6 4 4 1 Check = False Partition in RSF form. Partition of N = 15 Number of parts NPART = 4 1 4 5 6 Check = False Partition in RSF form. Partition of N = 15 Number of parts NPART = 4 1 4 4 6 Check = True part_sf_check_test(): part_sf_check() checks a standard form partition. Partition in SF form. Partition of N = 0 Number of parts NPART = 4 6 4 4 1 Check = False Partition in SF form. Partition of N = 15 Number of parts NPART = 0 (empty vector) Check = False Partition in SF form. Partition of N = 15 Number of parts NPART = 4 16 4 4 -9 Check = False Partition in SF form. Partition of N = 15 Number of parts NPART = 4 1 4 4 6 Check = False Partition in SF form. Partition of N = 15 Number of parts NPART = 4 6 5 4 1 Check = False Partition in SF form. Partition of N = 15 Number of parts NPART = 4 6 4 4 1 Check = True part_sf_conjugate_test(): part_sf_conjugate() produces the conjugate of a partition. Partitions of N = 8 0 1 1 1 1 1 1 1 1 8 1 2 1 1 1 1 1 1 7 1 2 2 2 1 1 1 1 6 2 3 2 2 2 1 1 5 3 4 2 2 2 2 4 4 5 3 1 1 1 1 1 6 1 1 6 3 2 1 1 1 5 2 1 7 3 2 2 1 4 3 1 8 3 3 1 1 4 2 2 9 3 3 2 3 3 2 10 4 1 1 1 1 5 1 1 1 11 4 2 1 1 4 2 1 1 12 4 2 2 3 3 1 1 13 4 3 1 3 2 2 1 14 4 4 2 2 2 2 15 5 1 1 1 4 1 1 1 1 16 5 2 1 3 2 1 1 1 17 5 3 2 2 2 1 1 18 6 1 1 3 1 1 1 1 1 19 6 2 2 2 1 1 1 1 20 7 1 2 1 1 1 1 1 1 21 8 1 1 1 1 1 1 1 1 part_sf_majorize_test(): part_sf_majorize() determines if one partition majorizes another. Partitions of N = 8 A: 2 2 2 1 1 B: 3 1 1 1 1 1 C: 2 2 1 1 1 1 A compare B: -2 B compare C: 1 C compare A: -1 C compare C: 0 part_successor_test(): part_successor() produces partitions of N, Partitions of N = 8 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 1 1 1 1 2 2 2 1 1 2 2 2 2 3 1 1 1 1 1 3 2 1 1 1 3 2 2 1 3 3 1 1 3 3 2 4 1 1 1 1 4 2 1 1 4 2 2 4 3 1 4 4 5 1 1 1 5 2 1 5 3 6 1 1 6 2 7 1 8 part_table_test(): part_table() tabulates partitions of N. I P(I) 0 1 1 1 2 2 3 3 4 5 5 7 6 11 7 15 8 22 9 30 10 42 partn_enum_test(): partn_enum() enumerates partitions of N with maximum part NMAX. NMAX: 1 2 3 4 5 6 N 0: 1: 1 2: 1 1 3: 1 1 1 4: 1 2 1 1 5: 1 2 2 1 1 6: 1 3 3 2 1 1 7: 1 3 4 3 2 1 8: 1 4 5 5 3 2 9: 1 4 7 6 5 3 10: 1 5 8 9 7 5 partn_sf_check_test(): partn_sf_check() checks a standard form partition of N with largest entry NMAX. Partition in SF form. Partition of N = 0 Maximum entry NMAX = 6 Number of parts NPART = 4 6 4 4 1 Check = False Partition in SF form. Partition of N = 15 Maximum entry NMAX = 6 Number of parts NPART = 0 (empty vector) Check = False Partition in SF form. Partition of N = 15 Maximum entry NMAX = 6 Number of parts NPART = 4 6 6 6 -3 Check = False Partition in SF form. Partition of N = 15 Maximum entry NMAX = 6 Number of parts NPART = 4 8 4 2 1 Check = False Partition in SF form. Partition of N = 15 Maximum entry NMAX = 6 Number of parts NPART = 4 1 4 4 6 Check = False Partition in SF form. Partition of N = 15 Maximum entry NMAX = 6 Number of parts NPART = 4 6 5 4 1 Check = False Partition in SF form. Partition of N = 15 Maximum entry NMAX = 6 Number of parts NPART = 4 6 4 4 1 Check = True partn_successor_test(): partn_successor() lists partitions of N with maximum element NMAX. Here, N = 11 NMAX = 4 4 1 1 1 1 1 1 1 4 2 1 1 1 1 1 4 2 2 1 1 1 4 2 2 2 1 4 3 1 1 1 1 4 3 2 1 1 4 3 2 2 4 3 3 1 4 4 1 1 1 4 4 2 1 4 4 3 partition_greedy_test(): partition_greedy() partitions an integer vector into two subsets with nearly equal sum. Data set 0 partitioned: 10 9 8 7 5 5 3 3 2 2 Sums: 27 27 Data set 1 partitioned: 1003 885 854 771 734 486 281 121 83 62 Sums: 2656 2624 perm_check_test(): perm_check() checks a permutation. Permutation: 5 1 8 3 4 Check = False Permutation: 5 1 4 3 4 Check = False Permutation: 5 1 2 3 4 Check = True perm_enum_test(): perm_enum() enumerates permutations of N items. N # 0 1 1 1 2 2 3 6 4 24 5 120 6 720 7 5040 8 40320 9 362880 10 3628800 perm_inv_test(): perm_inv() computes an inverse permutation. The permutation P: 1 2 3 4 3 1 2 4 The inverse permutation Q: 1 2 3 4 2 3 1 4 The product R = P * Q: 1 2 3 4 1 2 3 4 perm_lex_rank_test(): perm_lex_rank() ranks permutations using the lexicographic ordering. Element to be ranked: 1 2 3 4 3 1 2 4 The rank is computed to be 48. perm_lex_successor_test(): perm_lex_successor() lists permutations using the lexicographic ordering. 1 2 3 4 1 2 4 3 1 3 2 4 1 3 4 2 1 4 2 3 1 4 3 2 2 1 3 4 2 1 4 3 2 3 1 4 2 3 4 1 2 4 1 3 2 4 3 1 3 1 2 4 3 1 4 2 3 2 1 4 3 2 4 1 3 4 1 2 3 4 2 1 4 1 2 3 4 1 3 2 4 2 1 3 4 2 3 1 4 3 1 2 4 3 2 1 perm_lex_unrank_test(): perm_lex_unrank() unranks permutations using the lexicographic ordering. The element of rank 12: 1 2 3 4 3 1 2 4 perm_mul_test(): perm_mul() multiplies two permutations. The permutation P: 1 2 3 4 3 1 2 4 The permutation Q: 1 2 3 4 2 3 1 4 The product R = P * Q: 1 2 3 4 1 2 3 4 perm_parity_test(): perm_parity() computes the parity of a permutation. The permutation P: 1 2 3 4 5 5 1 3 4 2 The parity is 0 The permutation P: 1 2 3 4 5 3 4 2 1 5 The parity is 1 The permutation P: 1 2 3 4 5 4 2 5 1 3 The parity is 0 The permutation P: 1 2 3 4 5 4 2 5 3 1 The parity is 1 The permutation P: 1 2 3 4 5 2 3 5 1 4 The parity is 0 perm_print_test(): perm_print() prints a permutation of (1,...,N). A 1-based permutation: 1 2 3 4 5 6 7 7 2 4 1 5 3 6 perm_random_test(): perm_random() randomly selects a permutation of 1, ..., N. 4 2 5 1 3 5 2 3 1 4 5 3 4 1 2 2 5 1 3 4 1 5 2 4 3 perm_tj_rank_test(): perm_tj_rank() ranks permutations using the Trotter-Johnson ordering. Element to be ranked: 1 2 3 4 4 3 2 1 The rank is computed to be 12. perm_tj_successor_test(): perm_tj_successor() lists permutations using the Trotter-Johnson ordering. 1 2 3 4 1 2 4 3 1 4 2 3 4 1 2 3 4 1 3 2 1 4 3 2 1 3 4 2 1 3 2 4 3 1 2 4 3 1 4 2 3 4 1 2 4 3 1 2 4 3 2 1 3 4 2 1 3 2 4 1 3 2 1 4 2 3 1 4 2 3 4 1 2 4 3 1 4 2 3 1 4 2 1 3 2 4 1 3 2 1 4 3 2 1 3 4 perm_tj_unrank_test(): perm_tj_unrank() unranks permutations using the Trotter-Johnson ordering. The element of rank 12: 1 2 3 4 4 3 2 1 perm_to_cycle_test(): perm_to_cycle() converts a permutation from array to cycle form. Permutation: 1 2 3 4 5 6 7 4 5 1 2 3 6 7 Corresponding cycle form: Number of cycles is 3 4 2 5 3 1 6 7 pruefer_check_test(): pruefer_check() checks a Pruefer code. Check? N P(1:N-2) False 2: True 3: 1 False 4: 5 2 True 5: 5 1 3 pruefer_enum_test(): pruefer_enum() enumerates trees on N nodes, using the Pruefer code N # 0 1 1 1 2 1 3 3 4 16 5 125 6 1296 7 16807 8 262144 9 4782969 10 100000000 pruefer_random_test(): pruefer_random() returns a random Pruefer code. [6 2 6 5] [6 1 4 5] [2 5 5 4] [1 1 4 5] [4 5 4 4] [2 2 4 1] [1 4 5 4] [4 6 3 2] [6 4 3 5] [4 6 2 4] pruefer_rank_test(): pruefer_rank() ranks Pruefer codes. Element to be ranked: 3 1 The rank of the element is computed as 8: pruefer_successor_test(): pruefer_successor() lists Pruefer codes. 0 1 1 1 1 2 2 1 3 3 1 4 4 2 1 5 2 2 6 2 3 7 2 4 8 3 1 9 3 2 10 3 3 11 3 4 12 4 1 13 4 2 14 4 3 15 4 4 pruefer_to_tree_test(): pruefer_to_tree() converts a Pruefer code to a tree; Pruefer code 0 1 1 3 2 2 Edge list of tree: Col: 0 1 2 3 Row 0: 5 4 3 2 1: 1 3 2 1 Pruefer code 0 2 1 4 2 4 Edge list of tree: Col: 0 1 2 3 Row 0: 5 3 2 4 1: 2 4 4 1 Pruefer code 0 1 1 1 2 2 Edge list of tree: Col: 0 1 2 3 Row 0: 5 4 3 2 1: 1 1 2 1 Pruefer code 0 5 1 2 2 2 Edge list of tree: Col: 0 1 2 3 Row 0: 4 5 3 2 1: 5 2 2 1 Pruefer code 0 2 1 5 2 4 Edge list of tree: Col: 0 1 2 3 Row 0: 3 2 5 4 1: 2 5 4 1 pruefer_unrank_test(): pruefer_unrank() unranks Pruefer codes. The element of rank 8: 3 1 queens_test(): queens() produces nonattacking queens on a chessboard using a backtrack search. 8 4 1 3 6 2 7 5 8 3 1 6 2 5 7 4 8 2 5 3 1 7 4 6 8 2 4 1 7 5 3 6 7 5 3 1 6 8 2 4 7 4 2 8 6 1 3 5 7 4 2 5 8 1 3 6 7 3 8 2 5 1 6 4 7 3 1 6 8 5 2 4 7 2 6 3 1 4 8 5 7 2 4 1 8 5 3 6 7 1 3 8 6 4 2 5 6 8 2 4 1 7 5 3 6 4 7 1 8 2 5 3 6 4 7 1 3 5 2 8 6 4 2 8 5 7 1 3 6 4 1 5 8 2 7 3 6 3 7 4 1 8 2 5 6 3 7 2 8 5 1 4 6 3 7 2 4 8 1 5 6 3 5 8 1 4 2 7 6 3 5 7 1 4 2 8 6 3 1 8 5 2 4 7 6 3 1 8 4 2 7 5 6 3 1 7 5 8 2 4 6 2 7 1 4 8 5 3 6 2 7 1 3 5 8 4 6 1 5 2 8 3 7 4 5 8 4 1 7 2 6 3 5 8 4 1 3 6 2 7 5 7 4 1 3 8 6 2 5 7 2 6 3 1 8 4 5 7 2 6 3 1 4 8 5 7 2 4 8 1 3 6 5 7 1 4 2 8 6 3 5 7 1 3 8 6 4 2 5 3 8 4 7 1 6 2 5 3 1 7 2 8 6 4 5 3 1 6 8 2 4 7 5 2 8 1 4 7 3 6 5 2 6 1 7 4 8 3 5 2 4 7 3 8 6 1 5 2 4 6 8 3 1 7 5 1 8 6 3 7 2 4 5 1 8 4 2 7 3 6 5 1 4 6 8 2 7 3 4 8 5 3 1 7 2 6 4 8 1 5 7 2 6 3 4 8 1 3 6 2 7 5 4 7 5 3 1 6 8 2 4 7 5 2 6 1 3 8 4 7 3 8 2 5 1 6 4 7 1 8 5 2 6 3 4 6 8 3 1 7 5 2 4 6 8 2 7 1 3 5 4 6 1 5 2 8 3 7 4 2 8 6 1 3 5 7 4 2 8 5 7 1 3 6 4 2 7 5 1 8 6 3 4 2 7 3 6 8 5 1 4 2 7 3 6 8 1 5 4 2 5 8 6 1 3 7 4 1 5 8 6 3 7 2 4 1 5 8 2 7 3 6 3 8 4 7 1 6 2 5 3 7 2 8 6 4 1 5 3 7 2 8 5 1 4 6 3 6 8 2 4 1 7 5 3 6 8 1 5 7 2 4 3 6 8 1 4 7 5 2 3 6 4 2 8 5 7 1 3 6 4 1 8 5 7 2 3 6 2 7 5 1 8 4 3 6 2 7 1 4 8 5 3 6 2 5 8 1 7 4 3 5 8 4 1 7 2 6 3 5 7 1 4 2 8 6 3 5 2 8 6 4 7 1 3 5 2 8 1 7 4 6 3 1 7 5 8 2 4 6 2 8 6 1 3 5 7 4 2 7 5 8 1 4 6 3 2 7 3 6 8 5 1 4 2 6 8 3 1 4 7 5 2 6 1 7 4 8 3 5 2 5 7 4 1 8 6 3 2 5 7 1 3 8 6 4 2 4 6 8 3 1 7 5 1 7 5 8 2 4 6 3 1 7 4 6 8 2 5 3 1 6 8 3 7 4 2 5 1 5 8 6 3 7 2 4 r8vec_backtrack_test(): r8vec_backtrack() uses backtracking, seeking a vector X of N values which satisfies some condition. In this demonstration, we have 8 values W(I). We seek all subsets that sum to 53.0. X(I) is 0.0 or 1.0 if the entry is skipped or used. 1 53: 15 22 16 2 53: 15 14 16 8 3 53: 22 14 9 8 Done! rgf_check_test(): rgf_check() checks a restricted growth function. RGF:(empty vector) Check = False RGF: 0 1 2 3 4 5 6 Check = False RGF: 1 3 5 8 9 10 12 Check = False RGF: 1 2 3 1 4 5 4 Check = True rgf_enum_test(): rgf_enum() enumerates restricted growth functions. N # 0 1 1 1 2 2 3 5 4 15 5 52 6 203 7 877 8 4140 9 21147 10 115975 rgf_rank_test(): rgf_rank() ranks restricted growth functions. Element to be ranked: 1 2 1 3 The rank of the element is computed as 7: rgf_successor_test(): rgf_successor() lists restricted growth functions. 1 1 1 1 1 1 1 2 1 1 2 1 1 1 2 2 1 1 2 3 1 2 1 1 1 2 1 2 1 2 1 3 1 2 2 1 1 2 2 2 1 2 2 3 1 2 3 1 1 2 3 2 1 2 3 3 1 2 3 4 rgf_to_setpart_test(): rgf_to_setpart() converts a balanced sequence to a restricted growth function Restricted growth function: 1 1 1 1 1 2 1 3 Corresponding set partition: 1 2 3 4 5 7 6 8 rgf_unrank_test(): rgf_unrank() unranks restricted growth functions. The element of rank 7 1 2 1 3 rgf_g_table_test(): rgf_g_table() tabulates generalized restricted growth functions. 1 1 1 1 1 1 1 1 2 3 4 5 6 2 5 10 17 26 5 15 37 77 15 52 151 52 203 203 setpart_check_test(): setpart_check() checks a set partition. The set partition M = 0 NSUB = 3 3 6 1 4 7 2 5 8 Check = False The set partition M = 8 NSUB = 0 Check = False The set partition M = 8 NSUB = 3 3 6 1 4 7 2 5 8 Check = False The set partition M = 8 NSUB = 3 3 6 1 4 9 2 5 8 Check = False The set partition M = 8 NSUB = 3 3 6 1 4 6 2 5 8 Check = False The set partition M = 8 NSUB = 3 3 6 1 4 7 2 5 8 Check = True setpart_enum_test(): setpart_enum() enumerates set partitions. 1 1 2 2 3 5 4 15 5 52 6 203 setpart_to_rgf_test(): setpart_to_rgf() converts a set partition to a restricted growth function. The set partition M = 8 NSUB = 3 1 2 3 4 5 6 7 8 Recovered restricted growth function: 1 1 1 1 1 1 2 3 stirling_numbers1_test(): stirling_numbers1() computes a table of Stirling numbers of the first kind. Stirling numbers: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 -1 1 0 0 3: 0 2 -3 1 0 4: 0 -6 11 -6 1 5: 0 24 -50 35 -10 6: 0 -120 274 -225 85 Col: 5 6 Row 0: 0 0 1: 0 0 2: 0 0 3: 0 0 4: 0 0 5: 1 0 6: -15 1 stirling_numbers2_test(): stirling_numbers2() computes a table of Stirling numbers of the second kind. Stirling numbers: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 1 1 0 0 3: 0 1 3 1 0 4: 0 1 7 6 1 5: 0 1 15 25 10 6: 0 1 31 90 65 Col: 5 6 Row 0: 0 0 1: 0 0 2: 0 0 3: 0 0 4: 0 0 5: 1 0 6: 15 1 subset_check_test(): subset_check() checks a subset. Subset:(empty vector) Check = False Subset: 1 2 0 Check = False Subset: 1 0 0 1 0 Check = True subset_colex_rank_test(): subset_colex_rank() ranks subsets of a set, using the colexicographic ordering. The element: 0 1 0 1 0 The rank of the element is computed as 10: subset_colex_successor_test(): subset_colex_successor() lists subsets of a set, using the colexicographic ordering. 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 1 0 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 0 1 0 1 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 0 0 0 1 1 1 0 0 1 1 0 1 0 1 1 1 1 0 1 1 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 subset_colex_unrank_test(): subset_colex_unrank() unranks subsets of a set, using the colexicographic ordering. The subset of rank 10: 0 1 0 1 0 subset_complement_test(): subset_complement() returns the complement of a subset. Subset S1: 1 0 0 1 0 S2 = complement of S1: 0 1 1 0 1 subset_distance_test(): subset_distance() returns the distance between two subsets. Subset S1: 0 0 1 1 0 0 1 1 1 1 Subset S2: 0 0 0 0 1 0 1 1 0 1 distance between S1 and S2 is 4 subset_enum_test(): subset_enum() enumerates subsets of a set of N items. N # 0 1 1 2 2 4 3 8 4 16 5 32 6 64 7 128 8 256 9 512 10 1024 subset_intersect_test(): subset_intersect() returns the intersection of two subsets. Subset S1: 1 0 0 1 1 0 1 0 0 1 Subset S2: 0 1 0 1 0 1 0 0 0 0 intersection S3: 0 0 0 1 0 0 0 0 0 0 subset_lex_rank_test(): subset_lex_rank() ranks subsets of a set, using the lexicographic ordering. The element: 0 1 0 1 0 The rank of the element is computed as 10 subset_lex_successor_test(): subset_lex_successor() lists subsets of a set, using the lexicographic ordering. 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 subset_lex_unrank_test(): subset_lex_unrank() unranks subsets of a set, using the lexicographic ordering. The element of rank 10: 0 1 0 1 0 subset_random_test(): subset_random() returns a random subset. Subset: 0 1 0 0 1 Subset: 1 1 1 0 0 Subset: 1 1 0 1 1 Subset: 0 0 1 1 0 Subset: 0 0 0 1 0 Subset: 1 0 1 0 1 Subset: 0 1 0 1 0 Subset: 0 1 1 1 1 Subset: 1 1 0 1 0 Subset: 1 1 0 0 0 subset_union_test(): subset_union() returns the union of two subsets. Subset S1: 1 0 0 1 1 0 0 0 1 1 Subset S2: 1 0 0 0 1 0 0 1 1 1 Union S3: 1 0 0 1 1 0 0 1 1 1 subset_weight_test(): subset_weight() returns the weight of a subset. Subset S1: 0 0 0 0 0 0 0 0 1 1 The weight of the subset is 2 subset_xor_test(): subset_xor() returns the exclusive OR of two subsets. Subset S1: 1 0 1 0 1 1 0 1 1 1 Subset S2: 0 1 1 1 1 1 1 1 0 0 S3 = S1 xor S2: 1 1 0 1 0 0 1 0 1 1 subsetsum_swap_test(): subsetsum_swap() seeks a solution of the subset sum problem using pair swapping. The desired sum is 17 A(I), INDEX(I) 30 0 12 1 11 0 8 0 8 0 7 0 3 1 The achieved sum is 15 tableau_check_test(): tableau_check() checks a 2xN tableau. Check? Check = 0 tableau: (None) Check = 0 tableau: Col: 0 1 2 3 Row 0: 1 2 3 4 1: 2 4 7 9 Check = 0 tableau: Col: 0 1 2 3 Row 0: 1 3 5 3 1: 2 4 5 3 Check = 0 tableau: Col: 0 1 2 3 Row 0: 1 3 4 5 1: 2 4 5 3 Check = 1 tableau: Col: 0 1 2 3 Row 0: 1 3 6 7 1: 3 4 7 8 tableau_enum_test(): tableau_enum() enumerates tableaus on N nodes. N # 0 1 1 1 2 2 3 5 4 14 5 42 6 132 7 429 8 1430 9 4862 10 16796 tableau_to_bal_seq_test(): tableau_to_bal_seq() converts a tableau to a balanced sequence. tableau: Col: 0 1 2 3 Row 0: 1 2 5 6 1: 3 4 7 8 Balanced sequence: 0 0 1 1 0 0 1 1 tree_check_test(): tree_check() checks a tree. Check? N T(1:N) Check = False Tree: (None) Check = True Tree: Col: 0 1 Row 0: 1 2 1: 2 3 Check = False Tree: Col: 0 1 2 3 Row 0: 1 3 4 5 1: 2 4 5 3 Check = True Tree: Col: 0 1 2 3 4 Row 0: 1 2 3 4 5 1: 3 3 4 5 6 tree_enum_test(): tree_enum() enumerates trees on N nodes. N # 0 0 1 1 2 1 3 3 4 16 5 125 6 1296 7 16807 8 262144 9 4782969 10 100000000 tree_random_test(): tree_random() randomly selects a tree on N nodes. A random tree: Col: 0 1 2 3 4 Row 0: 6 5 3 4 2 1: 5 1 4 2 1 A random tree: Col: 0 1 2 3 4 Row 0: 5 4 2 3 6 1: 4 1 3 6 1 A random tree: Col: 0 1 2 3 4 Row 0: 5 4 2 3 6 1: 2 2 3 6 1 A random tree: Col: 0 1 2 3 4 Row 0: 4 2 5 6 3 1: 5 5 6 3 1 A random tree: Col: 0 1 2 3 4 Row 0: 6 4 3 2 5 1: 2 3 5 5 1 A random tree: Col: 0 1 2 3 4 Row 0: 4 3 5 6 2 1: 3 5 6 1 1 A random tree: Col: 0 1 2 3 4 Row 0: 6 4 3 5 2 1: 3 1 5 2 1 A random tree: Col: 0 1 2 3 4 Row 0: 4 3 2 5 6 1: 1 6 5 6 1 A random tree: Col: 0 1 2 3 4 Row 0: 6 4 2 3 5 1: 5 3 3 5 1 A random tree: Col: 0 1 2 3 4 Row 0: 5 3 2 4 6 1: 6 4 4 6 1 tree_rank_test(): tree_rank() ranks trees. The element: Col: 0 1 2 Row 0: 4 3 3 1: 1 2 1 The rank of the element is computed as 2: tree_successor_test(): tree_successor() lists trees. 0 4 3 2 1 1 1 1 4 3 2 1 2 1 2 4 2 3 1 3 1 3 3 2 4 1 4 1 4 4 3 2 2 1 1 5 4 3 2 2 2 1 6 4 2 3 2 3 1 7 3 2 4 2 4 1 8 4 3 2 3 1 1 9 4 3 2 3 2 1 10 4 2 3 3 3 1 11 2 3 4 3 4 1 12 3 4 2 4 1 1 13 3 4 2 4 2 1 14 2 4 3 4 3 1 15 3 2 4 4 4 1 tree_to_pruefer_test(): tree_to_pruefer() converts a tree to a Pruefer code. Pruefer code: 4 5 4 Edge list for corresponding tree: Col: 0 1 2 3 Row 0: 3 2 5 4 1: 4 5 4 1 Recovered Pruefer code: 4 5 4 Pruefer code: 1 3 5 Edge list for corresponding tree: Col: 0 1 2 3 Row 0: 4 2 3 5 1: 1 3 5 1 Recovered Pruefer code: 1 3 5 Pruefer code: 2 1 1 Edge list for corresponding tree: Col: 0 1 2 3 Row 0: 5 4 3 2 1: 2 1 1 1 Recovered Pruefer code: 2 1 1 Pruefer code: 4 5 5 Edge list for corresponding tree: Col: 0 1 2 3 Row 0: 3 4 2 5 1: 4 5 5 1 Recovered Pruefer code: 4 5 5 Pruefer code: 3 3 1 Edge list for corresponding tree: Col: 0 1 2 3 Row 0: 5 4 3 2 1: 3 3 1 1 Recovered Pruefer code: 3 3 1 tree_unrank_test(): tree_unrank() unranks trees. The element of rank 8: Col: 0 1 2 Row 0: 4 3 2 1: 3 1 1 combo_test(): Normal end of execution. Mon Sep 12 07:56:37 2022