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 sklearn.preprocessing import add_dummy_feature | |
class LinearRegression: | |
def __init__(self): | |
self.X = None | |
self.y = None | |
self.theta = None | |
self.coaf_ = None |
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 binary_search(data, param) -> bool : | |
found = False # To handle recursive calls | |
if len(data) == 0 : | |
return None | |
if len(data) == 2 : | |
if data[0] == param or data[1] == param : | |
return True |
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 linear_search(data, param) -> bool : | |
for el in data : | |
if el == param : # We found it | |
return True | |
return False | |
if __name__ == '__main__' : | |
data = [ 7, 10, 3, 1, 66, 6 ] | |
param = 1 # The integer we are looking for in the array |
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
std::shared_ptr<Type> sp; | |
Type* ptr = new Type(); | |
sp = ptr ; // compiler error!!! |
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 Type { | |
public: | |
foo(); | |
} | |
Type::foo(){ | |
// Doing something | |
} |