Skip to content

Instantly share code, notes, and snippets.

View iskakaushik's full-sized avatar

Kaushik Iska iskakaushik

View GitHub Profile
#include <cstdio>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int main() {
string s;
cin >> s;
MULTIPOLYGON(((-86.28800848066038 33.176736307673494,-86.28790119229978 33.17687998582289,-86.2878314548654 33.17684406630763,-86.28794947206205 33.17669589815153,-86.28800848066038 33.176736307673494)),((-86.28794276653952 33.17669028571646,-86.28790253340429 33.176665590997835,-86.28777646958059 33.1768115142342,-86.28781133829779 33.176838453882034,-86.28794276653952 33.17669028571646)),((-86.28789716898626 33.17666334602308,-86.28784352480596 33.176631916370326,-86.2877228254003 33.176789064521344,-86.28777646958059 33.176820494117734,-86.28789716898626 33.17666334602308)),((-86.28778988062567 33.176600486706306,-86.28784352480596 33.176631916370326,-86.28772550760931 33.17678681954975,-86.28766918122 33.17676661480273,-86.28778988062567 33.176600486706306)),((-86.28778451620764 33.17660273168268,-86.28737413822836 33.176373743796155,-86.28710189401335 33.17672283783491,-86.28751495420164 33.17695182480925,-86.28778451620764 33.17660273168268)),((-86.28737011491484 33.17636813134043,-86.28724136888212 33.
@iskakaushik
iskakaushik / poi-synth.csv
Created April 7, 2018 20:59
Synthetic POI Example
POI Name Latitude Longitude Parent Building
Levi's 37.1121 -127.112331 Hillsdale Mall
Cream Stone 37.11301 -127.112661 Hillsdale Mall
Uniqlo 37.11101 -127.112371 Hillsdale Mall
99 Ranch 37.44623 -126.1111233 99 Ranch - Milpitas
Delhi Masala 37.44618 -126.111027 99 Ranch - Milpitas
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
"name","wkt"
"Hillsdale Mall","POLYGON((-122.30062655184946 37.53862272401262,-122.30159214709482 37.539371367343186,-122.30232170794687 37.538826900211824,-122.30206421588144 37.53858869459169,-122.30240753863535 37.53834198082578,-122.3017316219636 37.537780491281076,-122.30180672381601 37.53756780474339,-122.30135611270151 37.53714242984815,-122.3010664341279 37.53715093736983,-122.29973605845652 37.53600241316314,-122.29934982035837 37.53598539785674,-122.29795507167063 37.5370658621093,-122.30010083888254 37.538928988101794,-122.30062655184946 37.53862272401262))"
"99 Ranch Mall - Milpitas","POLYGON((-121.91881917933222 37.42364933052066,-121.91771410921808 37.42397310706446,-121.91720985392328 37.42377713721835,-121.91687726000544 37.423206265612926,-121.91661976794 37.42328295011149,-121.91623352984186 37.42266947192397,-121.91650175074335 37.4225587044933,-121.9157626503088 37.421409801367815,-121.91578410798093 37.420847432486816,-121.91685571711554 37.42039327456982,-121.91712393801703 37.4207511483
Place 1 Place 2 Reason
Emelina's Emelina's Peruvian Restaurant Large edit distance
Hillsdale Mall Levi's Outlet Hillsdale Mall Gap Outlet High string similarity but these differ in key terms.
San Francisco Airport San Francisco Airport Terminal - 1 Nested places are hard.
Central Park Central Park Cafe In New York City, near Central Park, These may well be different. In most other places, they are almost certainly the same.
name city zip latitude longitude
wilby optical palo alto 94301 37.44192000000001 -122.14188000000001
deborahs palm palo alto 94301 37.45008668611999 -122.16012490336297
scandia home palo alto 94301 37.439011773629915 -122.15903442018154
archer income palo alto 94301 37.44547739819273 -122.16031641977904
sothebys international realty palo alto 94301 37.44265633306418 -122.15994234111085
rochelle ford metal sculptor palo alto 94301 37.442225034310475 -122.15209250463944
norwest venture partners palo alto 94301 37.4487871978415 -122.15927832038423
mirabelle jewelers palo alto 94301 37.44841299753496 -122.15676581670591
ace hardware palo alto 94301 37.440611098031866 -122.15912347499892
class Bin {
RegionSize binRegionSize;
List<Run> runs;
Run currentRun; // current run of this bin
}
class Run {
Bin bin; // bins are further down in our discussion
RegionSize regionSize; // the region size for this run.
List<Page> pages; // pages that are a part of this run.
int numFreeRegions;
int totalNumRegions = pages.size() / regionSize;
boolean freeRegions[totalNumRegions]; // initially all set to true
// more metadata to quickly identify the first available region
}
enum RegionSize {
SM_2(2),
SM_4(4),
SM_8(8),
SM_20(20),
SM_40(40),
.
.
.
LARGE_2MB(2 * 1024 * 1024);
class Chunk {
Arena arena; // Arena that this chunk is associated with
boolean dirtied; // this is set if the chunk has ever been dirtied
List<Run> runs;
// metadata about free pages for a region size
RBTreeMultimap<RegionSize, Page> freePages;
}