Skip to content

Instantly share code, notes, and snippets.

Tamim Shahriar tamim

Block or report user

Report or block tamim

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
@tamim
tamim / search_comparison.c
Last active Feb 15, 2019
A program to see the performance difference between linear search and binary search.
View search_comparison.c
#include <stdio.h>
#include <time.h>
int linear_search(int ara[], int n, int key)
{
for (int i = 0; i < n; i++) {
if (ara[i] == key) {
return i;
}
}
View struct_sorting_example.c
/***************************************************************************
Sort a struct array in C using qsort function
****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Student {
char name[30];
@tamim
tamim / allsubsets.py
Last active Dec 17, 2018
Python code to generate all subsets of a set.
View allsubsets.py
"""
Generate all subsets of a set using recursion
"""
def subsets1(S):
if S == []:
return [[]]
result = [[]]
n = len(S)
visited = [False] * n
@tamim
tamim / running_median.py
Last active Sep 16, 2018
implementation of max heap and min heap to solve running median problem
View running_median.py
import sys
def left(i):
return i * 2
def right(i):
return i * 2 + 1
@tamim
tamim / heap_example.py
Created Jun 1, 2018
Shows how can we use unit tests while implementing heap related functions in Python
View heap_example.py
def left(i):
return 2 * i
def test_left():
pass
def right(i):
return 2 * i + 1
You can’t perform that action at this time.