Skip to content

Instantly share code, notes, and snippets.

View shkesar's full-sized avatar

shubham shkesar

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<style>
/*div {
position: absolute;
width: 150px;
height: 150px;
border-radius: 100px;
background-color: red;
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW#include <stdio.h>
#include <stdlib.h>
#define HEAPSIZE 1000
struct heap_t {
int *S;
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
#include <stdio.h>
int main()
{
#include <iostream>
// GLEW
#define GLEW_STATIC
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
@shkesar
shkesar / rabin_karp.c
Created October 3, 2016 14:46
Rabin-Karp string matching algorithm
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define INVALID_OP -1
#define NOT_FOUND -2
typedef enum {TRUE = 0, FALSE} boolean;
@shkesar
shkesar / time.c
Created September 22, 2016 08:41
Time in C
#include <stdio.h>
#include <time.h>
int main()
{
time_t now = time(NULL);
struct tm *lt = localtime(&now);
printf("%d/%d/%d\n", lt->tm_mday, lt->tm_mon, 1900lt->tm_year);
return 0;
@shkesar
shkesar / insertion_sort.c
Created September 22, 2016 08:40
Insertion sort
#include <stdio.h>
#include <stdlib.h>
void display_array(int keys[], int len) {
for (int i = 0; i < len; i++) {
printf("%d ", keys[i]);
}
printf("\n");
}
@shkesar
shkesar / max_subarray.c
Created September 22, 2016 08:39
Maximum subarray problem
#include <stdio.h>
#include <limits.h>
#include <math.h>
int find_max_cross_array(int A[], int low, int mid, int high,
int *left, int *right) {
int max_left, max_right;
int sum = 0;
@shkesar
shkesar / hashtable.c
Created September 22, 2016 08:37
Hash table done in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hashtable.h"
struct nlist *hashtab[HASHSIZE];
unsigned hash(char *s) {
unsigned hashval = 0;
@shkesar
shkesar / second_smallest_marks_students.py
Created September 7, 2016 16:20
Hacker rank problem
no = int(input())
students = []
for i in range(no):
name = str(raw_input("Enter name: "))
marks = float(raw_input("Enter marks: "))
students.append([name, marks])
smallest = min(students, key=lambda x: x[1])