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
void insert(tree* root, tree* node) { | |
if(node == NULL) return; | |
tree* tmp = root; | |
while(true) { | |
if(tmp->d <= node->d) { | |
if(tmp->rt) | |
tmp = tmp->rt; |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <memory.h> | |
#include <string.h> | |
/** | |
* A simple example of how to serialize a struct to a file, and load it | |
* back into a different struct. | |
* |
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
var costMagnitudeRoll = ~~(Math.random() * 100); | |
if (costMagnitudeRoll < 70) { | |
cost = Math.random() * 30; | |
} | |
else if (costMagnitudeRoll < 90) { | |
cost = Math.random() * 70 + 30; | |
} | |
else if (costMagnitudeRoll < 99) { | |
cost = Math.random() * 400 + 100; |
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
struct entry { | |
int val; | |
int i, j; | |
entry(int val, int i, int j) { | |
this->val = val; | |
this->i = i; | |
this->j = j; | |
} | |
}; |
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
/// <summary> | |
/// Duplicates a ComplexMatrix without one columns and one row | |
/// </summary> | |
/// <param name="matrix"></param> | |
/// <param name="column"></param> | |
/// <param name="row"></param> | |
/// <returns></returns> | |
private Matrix make_matrix(Matrix matrix, int column) | |
{ | |
Matrix new_matrix = new Matrix(matrix.Rows - 1, matrix.Columns - 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
#include <iostream> | |
#include <climits> | |
#include <cstring> | |
#include <cmath> | |
using namespace std; | |
struct node { | |
int val; | |
node* nxt; | |
node(int val) { |
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
from random import randint | |
board = [] # makes blank board list | |
for x in range(5): | |
board.append(["O"] * 5) # Appends O,O,O,O,O to board[0 through 4] | |
def print_board(board): | |
for row in board: |
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
#!/bin/sh | |
# Start or stop Flashcache | |
### BEGIN INIT INFO | |
# Provides: flashcache | |
# Required-Start: $local_fs | |
# Required-Stop: $remote_fs $network pvedaemon | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 |
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 random | |
import json | |
places = [] | |
for x in range(1000): # your choice here | |
places.append({ | |
"name": "place %d" % x, | |
"lat": random.randint(-80, 80) + random.random(), | |
"lon": random.randint(-180, 180) + random.random(), |
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
define formatted_decimal => type { | |
data public value::decimal, | |
private flags | |
public onCreate(flags = (:)) => { | |
.value = 0.0 | |
.flags = #flags | |
} | |
public onCreate(v::decimal, flags = (:)) => { | |
.value = #v |
OlderNewer