Skip to content

Instantly share code, notes, and snippets.

Avatar
📚
Creativity Is Intelligence Having Fun!

Michael Serrato mikebsg01

📚
Creativity Is Intelligence Having Fun!
View GitHub Profile
@mikebsg01
mikebsg01 / Exam1.cu
Last active May 23, 2020
Parallel programming - Exam #1 - By: Michael Serrato
View Exam1.cu
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <cmath>
using namespace std;
/**
* @author Michael Serrato
@mikebsg01
mikebsg01 / VectorSum_by_MichaelSerrato.cu
Last active Mar 9, 2020
Vector Sum in CUDA C++ - By: Michael Serrato
View VectorSum_by_MichaelSerrato.cu
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <cmath>
using namespace std;
/**
* @author Michael Serrato
@mikebsg01
mikebsg01 / client.py
Created Feb 4, 2020
Chat with Sockets in Python 3
View client.py
import socket, threading, sys, pickle
class Client():
def __init__(self, host: str = '127.0.0.1', port: int = 5000, nickname: str = None, buffer_recv: int = 4096):
self.buffer_recv = buffer_recv
self.nickname = nickname
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.connect((host, port))
@mikebsg01
mikebsg01 / IntervalProduct.cpp
Created Jan 29, 2019
12532 - Interval Product
View IntervalProduct.cpp
#include <bits/stdc++.h>
using namespace std;
int N,K;
int List[100002]={0};
int BIT1[100002]={0};
int BIT2[100002]={0};
void update(int* A, int idx, int val){
while(idx<=N){
A[idx]+=val;
idx += (idx&(-idx));
@mikebsg01
mikebsg01 / LinearPascalWithPrimeModulo.cpp
Created Nov 19, 2018
Pascal (Linear Complexity) with Prime Modulo (Extended GCD)
View LinearPascalWithPrimeModulo.cpp
#include <bits/stdc++.h>
#define optimize_io ios_base::sync_with_stdio(0);cin.tie(0);
#define dd(x) cout << #x << ": " << x << endl;
#define MAXN ((int)(1e6+5))
#define MOD ((int)(1e9+7))
#define NOT_DEFINED -1
using namespace std;
typedef unsigned long long int ulli;
typedef long long int lli;
@mikebsg01
mikebsg01 / DP-Pascal-Triangle-with-Bitmasks.cpp
Created Oct 23, 2018
Pascal's Triangle with Bitmasks (DP Solution)
View DP-Pascal-Triangle-with-Bitmasks.cpp
#include <bits/stdc++.h>
#define dd(x) cout << #x << ": " << x << endl;
#define MAXN 1000003
#define MOD 1000000007
using namespace std;
typedef long long int lli;
int N;
lli dp[2][MAXN];
View TopoSort.cpp
#include<iostream>
#include <list>
#include <stack>
using namespace std;
// Class to represent a graph
class Graph
{
int V; // No. of vertices'
@mikebsg01
mikebsg01 / Dijkstra.cpp
Created Nov 27, 2017
Problem: Printing the Shortest Path with Dijkstra Algorithm - By: Michael Serrato
View Dijkstra.cpp
/*
* ALGORITHM: Dijkstra
*
* @author Michael Serrato <mikebsg01@gmail.com>
*/
#include <iostream>
#include <algorithm>
#include <climits>
#include <vector>
#include <map>
@mikebsg01
mikebsg01 / DFS.cpp
Last active Nov 27, 2017
Problem: Printing All Paths from a given source to a destination with Depth-First Search (DFS) Algorithm - By: Michael Serrato
View DFS.cpp
/*
* ALGORITHM: Depth-First Search (DFS)
*
* @author Michael Serrato <mikebsg01@gmail.com>
*/
#include <iostream>
#include <algorithm>
#include <cctype>
#include <vector>
#include <deque>
@mikebsg01
mikebsg01 / MaxHeapSort.cpp
Last active Nov 19, 2017
Max-Heap Sort (Algorithm) - By: Michael Serrato
View MaxHeapSort.cpp
/*
* ALGORITHM: MAX-HEAP SORT
*
* @author Serrato Guerrero Michael Brandon <mikebsg01@gmail.com>
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;
You can’t perform that action at this time.