Input: A formula in CNF
Output: Either "satisfiable" or "unsatisfiable".
Performance: O(2n), Space: O(n)
| #!/bin/sh | |
| mkdir ./inst | |
| python ../build_scripts/build_usd.py --no-python --no-tools --no-examples \ | |
| --no-imaging --no-tests --no-docs \ | |
| --no-ptex --no-openvdb --no-tutorials `pwd`/inst/ |
| // Code by https://github.com/Atrix256/STLCost | |
| // Blog at: https://blog.demofox.org/2019/08/10/measuring-debug-stl-container-perf-cost-in-msvc/ | |
| // Modified to run under google benchmark | |
| #include <benchmark/benchmark.h> | |
| #include <chrono> | |
| #include <cstdio> | |
| #include <iostream> | |
| #include <string> |
| import java.io.BufferedReader; | |
| import java.io.FileReader; | |
| public class test { | |
| public static void main(String[] args) { | |
| // We must put bufferedIO type work in a try-catch block | |
| // because it could throw an exception. | |
| try { | |
| // Create a new buffered reader object, |
| // Sample algorithm, lab 11: bubble sort | |
| // Josh Filstrup, GTA EECS Dept @ KU | |
| // November 17th, 2014 | |
| public class bubble { | |
| // A function to swap two elements of an array | |
| public static void swap(int[] xs, int i, int j) { | |
| // Create a temporary value so we don't lose | |
| // it when assigning to xs[i] in the next line. | |
| int tmp = xs[i]; |
| # Use Xft? | |
| use_xft yes | |
| xftfont Trebuchet MS:size=8 | |
| xftalpha 0.8 | |
| text_buffer_size 2048 | |
| # Up interval in seconds | |
| update_interval 1 | |
| # This is the number of times Conky will update before quitting. |
Disclaimer: This is not a comprehensive review. It is to help you emphasize important sections, but it is your responsibility to review all previous labs and relevant chapters in the text.
| # An implementation of the Maybe monad for Nim | |
| # This implements the traditional operations, bind(called chain) | |
| # and return(called box) as well as a few useful operators for | |
| # cleaning up usage of the monad. Also implemented the functor | |
| # operation fmap(called map) which allows a procedure to be called | |
| # on a wrapped value | |
| type | |
| Maybe*[T] = object | |
| case valid*: bool |
| {-# LANGUAGE GADTs, KindSignatures #-} | |
| data Tree :: * where | |
| Leaf :: Int -> Tree | |
| Node :: Tree -> Tree -> Tree | |
| deriving (Show,Eq,Ord) | |
| -- Write a function that sums the leaf values in a tree | |
| summation :: Tree -> Int | |
| summation (Leaf v) = v | |
| summation (Node l r) = (summation l) + (summation r) |