Skip to content

Instantly share code, notes, and snippets.

View pranavtbhat's full-sized avatar

Pranav Thulasiram Bhat pranavtbhat

View GitHub Profile
@pranavtbhat
pranavtbhat / gridcat.jl
Last active April 2, 2016 18:00
Grid concatenation of Sparse Matrices in julia.
function cat2d(X::Array{SparseMatrixCSC,2})
iX = ones(Int, size(X)...)
mX, nX = size(X)
m = sum([size(X[i,1], 1) for i in 1:size(X, 1)])
n = sum([size(X[1,i], 2) for i in 1:size(X, 2)])
Tv = eltype(X[1].nzval)
Ti = eltype(X[1].rowval)
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 1000000
void main()
{
int i=0;
srand(time(NULL));
for(i=0;i<SIZE;i++)
@pranavtbhat
pranavtbhat / Median.c
Last active February 19, 2021 05:52
Program that finds the median of list of numbers whose size is taken to be 10000000. It also prints out the total number of swaps(fundamental operation involved) to prove linear time complexity.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 1000000
int getMedian();
int count=0;
void swap();