Skip to content

Instantly share code, notes, and snippets.

View sshekh's full-sized avatar
:octocat:
Learning new things!

Saurav Shekhar sshekh

:octocat:
Learning new things!
View GitHub Profile
@sshekh
sshekh / System Design.md
Created December 25, 2017 12:57 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
#!/usr/bin/python
#
# Example usage
# $ ./gangnam.py | gnuplot
# 9
# 0 0
# 1 1
# 2 2
# 0 2
# 1 1
Note: I would reccommend you to first go through the blog of Utkarsh Lath on segment trees, before
using this segment tree class. Which could be found here - http://www.letuskode.blogspot.in/.
You will also find many good problems of spoj for practice which involves segment tree.
This segment Tree class requires the following headers:
-> 'math.h'
-> 'stdlib.h'
This segment tree class supports the following operations/functionalities:-
-> 'point update'
@sshekh
sshekh / README
Created June 5, 2014 20:22 — forked from utkarshl/README
In order to use segtree class defined above, you will need to create a datatype(a struct most likely), which will implement the function merge(). It can also additionally implement split, if you need to define the split operation.
A sample is shown as "struct segtree_node" in the code above.
The segtree has to be instantiated with this defined data type. For example,as
segtree<segtree_node> s;
You have to first call the init function of the class, which will take
int n=number of elements in your array,
node[] = your inital array,
identity = an element such that merge(y,identity) = merge(identity,y) = y for all y's.
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <stdlib.h>
#define RIGHT 19712
#define LEFT 19200
#define UP 18432
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include <stdlib.h>
#define RIGHT 19712
#define LEFT 19200
#define UP 18432
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()