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 Employee: | |
def __init__(self, name): | |
self.name = name | |
def get_name(self): | |
print(self.name) | |
def name(self): | |
print(self.name) |
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 pandas as pd | |
from sklearn.neighbors import KNeighborsRegressor | |
from sklearn.metrics import mean_squared_error | |
train = {'author': ['green', 'white'], | |
'age': [21, 34], | |
'pages': [100, 200], | |
} | |
train = pd.DataFrame(train) |
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
[ | |
{ | |
"message" : "how do you feel today?", | |
"response" : "i feel like helping you." | |
}, | |
] |
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
<?xml version = "1.0" encoding = "UTF-8"?> | |
<aiml version = "1.0.1" encoding = "UTF-8"?> | |
<category> | |
<pattern>A * IS A *</pattern> | |
<template> | |
Of course that <star index = "1"/> is a <star index = "2"/>. | |
</template> | |
</category> | |
</aiml> |
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 numpy as np | |
from scipy.sparse import csr_matrix | |
from sklearn.base import BaseEstimator, TransformerMixin | |
class FeatureComputer(BaseEstimator, TransformerMixin): | |
def __init__(self, train_data): | |
self.data = train_data |
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<limits.h> | |
int main(void) { | |
unsigned int x = 1; | |
int x2 = 1; | |
printf("unsigned: %u\n", x << 31); | |
printf("signed:(-1) %d\n", (x2 << 31) - 1); | |
printf("signed: %d\n", x2 << 31); |
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
sort [] = [] | |
sort [x] = [x] | |
sort (x:xs) = insert (sort xs) | |
where insert [] = [x] | |
insert (y:ys) | x <= y = x : y : ys | |
| otherwise = y : insert ys |
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
suml [] = 0 | |
suml (x:xs) = x + suml xs |
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
public class recursiveMethod { | |
// print something only once in a recursive method | |
public static int y = 0; | |
public static boolean recursiveMethod(int x) { | |
if (x > 4) { | |
return true; | |
} | |
Exception e = new Exception(); | |
e.fillInStackTrace(); | |
if (e.getStackTrace().length == 2) { |
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
boolean checkBST(Node root) { | |
return checkHelper(root, Integer.MIN_VALUE, Integer.MAX_VALUE); | |
} | |
boolean checkHelper(Node node, int min_left, int max_right) { | |
if (node == null) { | |
return true; | |
} | |
if (node.data <= min_left || node.data >= max_right) { |
NewerOlder