This file contains hidden or 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
| CREATE OR REPLACE FUNCTION bits_count(value bigint) RETURNS integer AS $$ | |
| DECLARE i integer; | |
| c integer; | |
| bits BIT(25); | |
| BEGIN | |
| c := 0; | |
| bits := value::BIT(25); | |
| FOR i IN 1..LENGTH(bits) LOOP | |
| IF substring(bits, i, 1) = B'1' THEN | |
| c := c + 1; |
This file contains hidden or 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 range_binary_search(int *array, int len, int val, int *res) { | |
| int right = 0; | |
| int left = 0; | |
| int middle; | |
| // not found | |
| if(val < array[0] || val > array[len - 1]){ | |
| right = 0; | |
| left = -1; | |
| } |
This file contains hidden or 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 "stack.h" | |
| void create_stack(stack * st) { | |
| st -> indx = -1; | |
| st -> size = 0; | |
| } | |
| // check empty |
This file contains hidden or 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 <string.h> | |
| #define STRLEN 20 | |
| struct linked_queue { | |
| char data[STRLEN]; | |
| float priority; | |
| struct linked_queue * next; | |
| }; |
This file contains hidden or 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 pickle | |
| import numpy as np | |
| import theano | |
| import pymc3 as pm | |
| def relu(x): | |
| return pm.math.maximum(0, x) | |
OlderNewer