This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KnapSack_DP::KnapSack_DP(int capacity, vector<int> pids, catalog* cat) | |
{ | |
this->capacity = capacity; | |
this->pids = pids; | |
this->cat = cat; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
#include "knapsack.h" | |
#define maxcount 10 | |
using namespace std; | |
// ******* DATA STRUCTURES *********** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(getline(fbase, line)) | |
{ | |
cudaEventSynchronize(finishedMemcpyEvent); | |
if (!(fbase >> user >> movie >> day >> rating)){ | |
data_idx++; | |
continue; | |
} | |
// process the line. Store indices instead of values | |
buffer[data_idx % batchsize] = DataPoint(user - 1, movie - 1, rating); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def similarity(self, G=None, H=None, iters=20): | |
""" Returns the graph similarity based on Neighbor Matching[Ref] | |
Derived from 'wadsashika'_ | |
:param G: networkx graph of original graph (default: self.G) | |
:param H: networkx graph of inferred graph (default: self.H) | |
:param iter: number of iterations (default: 20) | |
:return: float | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map3 :: (a->b->c->d) -> [a] -> [b] -> [c] -> [d] | |
map3 _ [] _ _ = [] | |
map3 _ _ [] _ = [] | |
map3 _ _ _ [] = [] -- Is there a better way to do this? ¯\_(ツ)_/¯ | |
map3 f (x:xs) (y:ys) (z:zs) = f x y z : map2 f xs ys zs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Lab5 where | |
import Control.Monad | |
import Data.List | |
-- A.1 | |
hrSolutions :: [((Integer, Integer), (Integer, Integer), Integer)] | |
hrSolutions = do | |
i <- [1..] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useRef, useState } from 'react'; | |
import { Stage, Layer, Line} from 'react-konva'; | |
import Konva from 'konva'; | |
import '../styles/MyComponent.css'; | |
import {Mode} from './constants' | |
function DrawingCanvas() { | |
const stageRef = useRef<Stage>(null); | |
const stage = stageRef.current || new Stage({width: 600, height: 400}); | |
const [isPaint, setIsPaint] = useState(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function DrawingComponent(props: DrawingComponentProps) { | |
... | |
const [histories, setHistories] = useState<Array<History>>([]); | |
... | |
function clear() { | |
layerRef.current?.destroyChildren(); | |
layerRef.current?.clear(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style>.eventIcon sf, hr, #superfooter, #header, #userneohome, #footer, #habitarium, #ncmall, #ban, #usershop, #usercollections img, #ad-slug-wrapper{display: none;}.contentModuleHeader, .contentModuleHeaderAlt, h1{text-align: center;font: 7pt verdana;letter-spacing: 3px;text-transform: uppercase;color: #FFF;padding: 0px;background: #c2e0f8;line-height: 20pt;}body{background: #EFEFEF;}h1{margin: 0;}#main{width: 1195px;margin-top: -30px;background: 0;border: 0;}#box, .contentModuleTable, #box2{background: #FFF;border: 1px solid #EBEBEB;}#userinfo{width: 400px;}#usercollections{width: 390px;}.medText{padding: 5px;}.contentModuleContent{padding: 10px;}#userinfo, #usercollections{height: 310px !important;}#usertrophies, #usertrophies .medText{width: 800px !important;}#userneopets img:hover{border: 3px solid #ccc;}#scroll > div img, #userneopets img, #userinfo a img{border-radius: 210px!important;}p, td, div, b{color: #bebebe;font: 10pt tahoma;}a{text-decoration: none;color: #565656 !important;}a:hover{text-decora |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare function assert(value: unknown): asserts value; | |
interface Rule { | |
ref: string, | |
raw: Array<string>, | |
compiled: string | null, | |
cyclic: boolean, | |
} | |
const orRule: Rule = { |
OlderNewer