Advertisement
szabozoltan69

subsets1

May 14th, 2014
516
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.51 KB | None | 0 0
  1. #!/bin/bash
  2. #abcd                                          | comm1, comm2, comm3 := comm -23, comm -13, comm -12  
  3. #0000       cc                                 ┌──┤  C  ├──┐
  4. #0001     0132                                 │           │
  5. #0010     4576 b                   ┌───────────┼───────────┼───┐
  6. #0011   a CDFE b                   │     ┌─────┼─────┐     │   │
  7. #0100   a 89BA                     │     │     │     │     │   ┴
  8. #0101      dd                   ┌──┼─────┼─────┼─────┼─────┼─┐ B
  9. #0110     Karnaugh map          │  │     │     │     │     │ │ ┬
  10. #0111                           ┴  │     │     │     │     │ │ │
  11. #1000                           A  └─────┼─────┼─────┼─────┼─┼─┘
  12. #1001                           ┬        │     │     │     │ │
  13. #1010                           │        │     │     │     │ │
  14. #1011                           └────────┼─────┼─────┼─────┼─┘
  15. #1100                                    │     │     │     │
  16. #1101                                    │     └─────┼─────┘
  17. #1110                                    │           │
  18. #1111                                    └──┤  D  ├──┘
  19.  
  20. echo "We suppose that a, b, c, d are ordered lists."
  21.  
  22. #s0000 not needed
  23. comm1 d c >tmp1; comm1 tmp1 b >tmp2; comm1 tmp2 a >s0001
  24. comm1 c d >tmp1; comm1 tmp1 b >tmp2; comm1 tmp2 a >s0010
  25. comm3 c d >tmp1; comm1 tmp1 b >tmp2; comm1 tmp2 a >s0011 #in both c and d, from result: not in b, from result: not in a
  26. comm1 b d >tmp1; comm1 tmp1 c >tmp2; comm1 tmp2 a >s0100
  27. comm3 b d >tmp1; comm1 tmp1 c >tmp2; comm1 tmp2 a >s0101
  28. comm3 b c >tmp1; comm1 tmp1 a >tmp2; comm1 tmp2 d >s0110
  29. comm3 c d >tmp1; comm3 tmp1 b >tmp2; comm1 tmp2 a >s0111
  30. comm1 a b >tmp1; comm1 tmp1 c >tmp2; comm1 tmp2 d >s1000
  31. comm3 a d >tmp1; comm1 tmp1 b >tmp2; comm1 tmp2 c >s1001
  32. comm3 a c >tmp1; comm1 tmp1 b >tmp2; comm1 tmp2 d >s1010
  33. comm3 a c >tmp1; comm3 tmp1 d >tmp2; comm1 tmp2 b >s1011
  34. comm3 a b >tmp1; comm1 tmp1 c >tmp2; comm1 tmp2 d >s1100
  35. comm3 a b >tmp1; comm3 tmp1 d >tmp2; comm1 tmp2 c >s1101
  36. comm3 a b >tmp1; comm3 tmp1 c >tmp2; comm1 tmp2 d >s1110
  37. comm3 a b >tmp1; comm3 tmp1 c >tmp2; comm3 tmp2 d >s1111
  38. rm -f tmp1 tmp2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement