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
class MinHeap { | |
constructor(selector = x => x[0]) { | |
this.items = [0]; | |
this.selector = selector; | |
} | |
insert(item) { | |
let childIdx = this.items.length; | |
this.items.push(item); | |
let childItem = item; | |
let parentIdx = Math.trunc(childIdx/2), parentItem = this.items[parentIdx]; |
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
#!/usr/bin/ruby -W0 | |
BEGIN { | |
puts "This block will always run first." | |
print <<EOF | |
---------------- | |
EOF | |
} # notice EOF cannot be indented | |
END { | |
print <<"up2u" | |
---------------- |
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.7; // '^' is for >= this version | |
/* DISCLAIMER: | |
This is a sample that provides a brief overview and glimpse into the basics of Solidity 0.8 types and language structure. | |
It is a quick breakdown meant for those with previous coding experience. All the highlights and key points are noted as comments. | |
With the economics and scalability-congestion of ETH in mind, search for "GAS" tips that help lower the cost of your contract executions. | |
*/ | |
contract HelloWorld { | |
string public myString = "hello world"; |
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
;; Calculates factorial of arbitrary number using LC-3b assembly. (Only LDR/STR/ADD/AND/NOT/BR instructions supported.) | |
ORIGIN 4x0000 | |
SEGMENT CodeSegment: | |
;; Assuming all registers, specifically R0, are zeroed at beginning | |
;; R0 - x0000 throughout program for convenience due to limited instrs | |
;; R1 - accumulator of final factorial RESULT ("s") | |
;; R2 - down counter of 's' additions in each round (inner loop, "j") | |
;; R3 - down counter of factorial rounds from x to 0 (outer loop, "i") | |
;; R4 - 's' at the beginning of reach round ("n") | |
;; R5 - contain decrement value (-1) for convenience |
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
#ifndef MXNET_OPERATOR_NEW_FORWARD_CUH_ | |
#define MXNET_OPERATOR_NEW_FORWARD_CUH_ | |
#define TILE_WIDTH 24 // has to be a multiple of this to get correctness = 0.8562 | |
//#define TILE_WIDTH 8 | |
#include <mxnet/base.h> | |
namespace mxnet | |
{ | |
namespace op |