Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block alejandroerickson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
alejandroerickson / contains_subtree.c
Last active Aug 15, 2016
Check if binary tree t2 on n nodes is a subtree of binary tree t1 on n nodes in O(m+(1+epsilon)n) time
View contains_subtree.c
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define max(a,b) ((a>b)?a:b)
#define timeit(a,b){ \
start=clock(); \
a; \
end=clock(); \
alejandroerickson /
Last active Aug 14, 2016
Given N rectangles, check whether they cover a rectangle exactly (with no overlaps).
def isBigRect(rectangles):
if rectangles==[]:
return True
# print L, R
if L==False or R==False or not len(L)==len(R):
return False
View int_length_bit_twiddle.c
#include <stdlib.h>
#include <stdio.h>
void print_bits(uint32_t x);
uint32_t uint32_smear_right(uint32_t x){
x = x | x>>1;
x = x | x>>2;
x = x | x>>4;
x = x | x>>8;
You can’t perform that action at this time.