|
2 | 2 |
|
3 | 3 | [](https://github.com/asarkar/99-haskell/actions) |
4 | 4 |
|
5 | | -Some problems are intentionally unsolved, because they |
6 | | -are uninteresting/improbable in the context of Haskell. |
7 | | -- These are the problems 38, 47, and 54. |
8 | | - |
9 | 5 | A number of problems were added to fill out 99 problems. |
10 | 6 | - These are the problems 29, 30, 42, 43, 44, 45, 51, 52, 53, 74, 75, 76, 77, 78, and 79. |
11 | 7 |
|
12 | | -## The problems |
| 8 | +## Working with lists |
| 9 | + |
| 10 | +[P01](src/List/P01.hs) (*) Find the last element of a list. |
| 11 | + |
| 12 | +[P02](src/List/P02.hs) (*) Find the last but one element of a list. |
| 13 | + |
| 14 | +[P03](src/List/P03.hs) (*) Find the Kth element of a list. |
| 15 | + |
| 16 | +[P04](src/List/P04.hs) (*) Find the number of elements of a list. |
| 17 | + |
| 18 | +[P05](src/List/P05.hs) (*) Reverse a list. |
| 19 | + |
| 20 | +[P06](src/List/P06.hs) (*) Find out whether a list is a palindrome. |
| 21 | + |
| 22 | +[P07](src/List/P07.hs) (**) Flatten a nested list structure. |
| 23 | + |
| 24 | +[P08](src/List/P08.hs) (**) Eliminate consecutive duplicates of list elements. |
| 25 | + |
| 26 | +[P09](src/List/P09.hs) (**) Pack consecutive duplicates of list elements into sublists. |
| 27 | + |
| 28 | +[P10](src/List/P10.hs) (*) Run-length encoding of a list. |
| 29 | + |
| 30 | +[P11](src/List/P11.hs) (*) Modified run-length encoding. |
| 31 | + |
| 32 | +[P12](src/List/P12.hs) (**) Decode a run-length encoded list. |
| 33 | + |
| 34 | +[P13](src/List/P13.hs) (**) Run-length encoding of a list (direct solution). |
| 35 | + |
| 36 | +[P14](src/List/P14.hs) (*) Duplicate the elements of a list. |
| 37 | + |
| 38 | +[P15](src/List/P15.hs) (**) Duplicate the elements of a list a given number of times. |
| 39 | + |
| 40 | +[P16](src/List/P16.hs) (**) Drop every Nth element from a list. |
| 41 | + |
| 42 | +[P17](src/List/P17.hs) (*) Split a list into two parts. |
| 43 | + |
| 44 | +[P18](src/List/P18.hs) (**) Extract a slice from a list. |
| 45 | + |
| 46 | +[P19](src/List/P19.hs) (**) Rotate a list N places to the left. |
| 47 | + |
| 48 | +[P20](src/List/P20.hs) (*) Remove the Kth element from a list. |
| 49 | + |
| 50 | +[P21](src/List/P21.hs) (*) Insert an element at a given position into a list. |
| 51 | + |
| 52 | +[P22](src/List/P22.hs) (*) Create a list containing all integers within a given range. |
| 53 | + |
| 54 | +[P23](src/List/P23.hs) (**) Extract a given number of randomly selected elements from a list. |
| 55 | + |
| 56 | +[P24](src/List/P24.hs) (*) Lotto: Draw N different random numbers from the set 1..M. |
| 57 | + |
| 58 | +[P25](src/List/P25.hs) (*) Generate a random permutation of the elements of a list. |
| 59 | + |
| 60 | +[P26](src/List/P26.hs) (**) Generate the combinations of K distinct objects chosen from the N elements of a list. |
| 61 | + |
| 62 | +[P27](src/List/P27.hs) (**) Group the elements of a set into disjoint subsets. |
| 63 | + |
| 64 | +[P28](src/List/P28.hs) (**) Sorting a list of lists according to length of sublists. |
| 65 | + |
| 66 | +[P29](src/List/P28.hs) (*) Write a function to compute the nth Fibonacci number. |
| 67 | + |
| 68 | +[P30](src/List/P30.hs) (**) Write a function to compute the nth Fibonacci number. |
| 69 | + |
| 70 | +## Arithmetic |
| 71 | + |
| 72 | +[P31](src/Arithmetic/P31.hs) (**) Determine whether a given integer number is prime. |
| 73 | + |
| 74 | +[P32](src/Arithmetic/P32.hs) (**) Determine the greatest common divisor of two positive integer numbers. |
| 75 | + |
| 76 | +[P33](src/Arithmetic/P33.hs) (*) Determine whether two positive integer numbers are coprime. |
| 77 | + |
| 78 | +[P34](src/Arithmetic/P34.hs) (**) Calculate Euler’s totient function ϕ(m). |
| 79 | + |
| 80 | +[P35](src/Arithmetic/P35.hs) (**) Determine the prime factors of a given positive integer. |
| 81 | + |
| 82 | +[P36](src/Arithmetic/P36.hs) (**) Determine the prime factors of a given positive integer (2). |
| 83 | + |
| 84 | +[P37](src/Arithmetic/P37.hs) (**) Calculate Euler’s totient function ϕ(m) (improved). |
| 85 | + |
| 86 | +[P38](src/Arithmetic/P38.hs) (*) Compare the two methods of calculating Euler’s totient function. |
| 87 | + |
| 88 | +[P39](src/Arithmetic/P39.hs) (*) A list of prime numbers. |
| 89 | + |
| 90 | +[P40](src/Arithmetic/P40.hs) (**) Goldbach's conjecture. |
| 91 | + |
| 92 | +[P41](src/Arithmetic/P41.hs) (**) A list of Goldbach compositions. |
| 93 | + |
| 94 | +[P42](src/Arithmetic/P42.hs) (**) Modular multiplicative inverse. |
| 95 | + |
| 96 | +[P43](src/Arithmetic/P43.hs) (*) Gaussian integer divisibility. |
| 97 | + |
| 98 | +[P44](src/Arithmetic/P44.hs) (**) Gaussian primes. |
| 99 | + |
| 100 | +[P45](src/Arithmetic/P45.hs) (*) Gaussian primes using the two-square theorem. |
| 101 | + |
| 102 | +## Logic and Codes |
| 103 | + |
| 104 | +[P46](src/Logic/P46.hs) (**) Truth tables for logical expressions. |
| 105 | + |
| 106 | +[P47](src/Logic/P47.hs) (*) Truth tables for logical expressions (2). |
| 107 | + |
| 108 | +[P48](src/Logic/P48.hs) (**) Truth tables for logical expressions (3). |
| 109 | + |
| 110 | +[P49](src/Logic/P49.hs) (**) Gray code. |
| 111 | + |
| 112 | +[P50](src/Logic/P50.hs) (***) Huffman code. |
| 113 | + |
| 114 | +[P51](src/Logic/P51.hs) (*) Error correction codes. |
| 115 | + |
| 116 | +[P52](src/Logic/P52.hs) (***) Conjunctive normal form. |
| 117 | + |
| 118 | +[P53](src/Logic/P53.hs) (***) Resolution rule. |
| 119 | + |
| 120 | +## Binary Trees |
| 121 | + |
| 122 | +P54A omitted; our tree representation will only allow well-formed trees. |
| 123 | + |
| 124 | +[P55](src/BinaryTree/P55.hs) (**) Construct completely balanced binary trees. |
| 125 | + |
| 126 | +[P56](src/BinaryTree/P56.hs) (**) Symmetric binary trees. |
| 127 | + |
| 128 | +[P57](src/BinaryTree/P57.hs) (**) Binary search trees (dictionaries). |
| 129 | + |
| 130 | +[P58](src/BinaryTree/P58.hs) (**) Generate-and-test paradigm. |
| 131 | + |
| 132 | +[P59](src/BinaryTree/P59.hs) (**) Construct height-balanced binary trees. |
| 133 | + |
| 134 | +[P60](src/BinaryTree/P60.hs) (**) Construct height-balanced binary trees with a given number of nodes. |
| 135 | + |
| 136 | +[P61](src/BinaryTree/P61.hs) (*) Count the leaves of a binary tree. |
| 137 | + |
| 138 | +[P61A](src/BinaryTree/P61a.hs) (*) Collect the leaves of a binary tree in a list. |
| 139 | + |
| 140 | +[P62](src/BinaryTree/P62.hs) (*) Collect the internal nodes of a binary tree in a list. |
| 141 | + |
| 142 | +[P62B](src/BinaryTree/P62b.hs) (*) Collect the nodes at a given level in a list. |
| 143 | + |
| 144 | +[P63](src/BinaryTree/P63.hs) (**) Construct a complete binary tree. |
| 145 | + |
| 146 | +[P64](src/BinaryTree/P64.hs) (**) Layout a binary tree (1). |
| 147 | + |
| 148 | +[P65](src/BinaryTree/P65.hs) (**) Layout a binary tree (2). |
| 149 | + |
| 150 | +[P66](src/BinaryTree/P66.hs) (***) Layout a binary tree (3). |
| 151 | + |
| 152 | +[P67A](src/BinaryTree/P67a.hs) (**) A string representation of binary trees. |
| 153 | + |
| 154 | +[P68](src/BinaryTree/P68.hs) (**) Preorder and inorder sequences of binary trees. |
| 155 | + |
| 156 | +[P69](src/BinaryTree/P69.hs) (**) Dotstring representation of binary trees. |
| 157 | + |
| 158 | +## Multiway Trees |
| 159 | + |
| 160 | +P70B omitted; we can only create well-formed trees. |
| 161 | + |
| 162 | +[P70C](src/MultiwayTree/P70c.hs) (*) Count the nodes of a multiway tree. |
| 163 | + |
| 164 | +[P70](src/MultiwayTree/P70.hs) (**) Tree construction from a node string. |
| 165 | + |
| 166 | +[P71](src/MultiwayTree/P71.hs) (*) Determine the internal path length of a tree. |
| 167 | + |
| 168 | +[P72](src/MultiwayTree/P72.hs) (*) Construct the postorder sequence of the tree nodes. |
| 169 | + |
| 170 | +[P73](src/MultiwayTree/P73.hs) (**) Lisp-like tree representation. |
| 171 | + |
| 172 | + |
| 173 | +## Monads |
| 174 | + |
| 175 | +[P74](src/Monad/P74.hs) (**) Monads without do notation. |
| 176 | + |
| 177 | +[P75](src/Monad/P75.hs) (*) Maybe monad. |
| 178 | + |
| 179 | +[P76](src/Monad/P76.hs) (*) Either monad. |
| 180 | + |
| 181 | +[P77](src/Monad/P77.hs) (*) List monad. |
| 182 | + |
| 183 | +[P78](src/Monad/P78.hs) (*) Collatz conjecture. |
| 184 | + |
| 185 | +[P79](src/Monad/P79.hs) (**) Postfix notation. |
| 186 | + |
| 187 | +## Graphs |
| 188 | + |
| 189 | +[P80](src/Graph/P80.hs) (***) Conversions. |
| 190 | + |
| 191 | +[P81](src/Graph/P81.hs) (**) Path from one node to another one. |
| 192 | + |
| 193 | +[P82](src/Graph/P82.hs) (*) Cycle from a given node. |
| 194 | + |
| 195 | +[P83](src/Graph/P83.hs) (**) Construct all spanning trees. |
| 196 | + |
| 197 | +[P84](src/Graph/P84.hs) (**) Construct the minimal spanning tree. |
| 198 | + |
| 199 | +[P85](src/Graph/P85.hs) (**) Graph isomorphism. |
| 200 | + |
| 201 | +[P86](src/Graph/P86.hs) (**) Node degree and graph coloration. |
| 202 | + |
| 203 | +[P87](src/Graph/P87.hs) (**) Depth-first order graph traversal. |
| 204 | + |
| 205 | +[P88](src/Graph/P88.hs) (**) Connected components. |
13 | 206 |
|
14 | | -* Questions 1 to 10: [Lists](src/Lists.hs) |
| 207 | +[P89](src/Graph/P89.hs) (**) Bipartite graphs. |
15 | 208 |
|
16 | | -* Questions 11 to 20: [Lists, continued](src/Lists2.hs) |
| 209 | +## Miscellaneous Problems |
17 | 210 |
|
18 | | -* Questions 21 to 30: [Lists again](src/Lists3.hs) |
| 211 | +[P90](src/Misc/P90.hs) (**) Eight queens problem. |
19 | 212 |
|
20 | | -* Questions 31 to 45: [Arithmetic](src/Arithmetic.hs) |
| 213 | +[P91](src/Misc/P91.hs) (**) Knight’s tour. |
21 | 214 |
|
22 | | -* Questions 46 to 53: [Logic and codes](src/Logic.hs) |
| 215 | +[P92](src/Misc/P92.hs) (***) Von Koch’s conjecture. |
23 | 216 |
|
24 | | -* Questions 54A to 60: [Binary trees](src/BinaryTrees.hs) |
| 217 | +[P93](src/Misc/P93.hs) (***) An arithmetic puzzle. |
25 | 218 |
|
26 | | -* Questions 61 to 69: [Binary trees, continued](src/BinaryTrees2.hs) |
| 219 | +[P94](src/Misc/P94.hs) (***) Generate K-regular simple graphs with N nodes. |
27 | 220 |
|
28 | | -* Questions 70B to 73: [Multiway trees](src/MultiwayTrees.hs) |
| 221 | +[P95](src/Misc/P95.hs) (**) English number words. |
29 | 222 |
|
30 | | -* Questions 74 to 79: [Monads](src/Monads.hs) |
| 223 | +[P96](src/Misc/P96.hs) (**) Syntax checker. |
31 | 224 |
|
32 | | -* Questions 80 to 89: [Graphs](src/Graphs.hs) |
| 225 | +[P97](src/Misc/P97.hs) (**) Sudoku. |
33 | 226 |
|
34 | | -* Questions 90 to 94: [Miscellaneous problems](src/Misc.hs) |
| 227 | +[P98](src/Misc/P98.hs) (***) Nonograms. |
35 | 228 |
|
36 | | -* Questions 95 to 99: [Miscellaneous problems, continued](src/Misc2.hs) |
| 229 | +[P99](src/Misc/P99.hs) (***) Crossword puzzle. |
37 | 230 |
|
38 | 231 | ## Running tests |
39 | 232 |
|
|
0 commit comments