This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/assign/list_of.hpp> | |
#include <vector> | |
using namespace std; | |
vector<int> array_left_rotation(vector<int> a, int n, int k) { | |
vector<int> rotated; | |
int index = k % n; | |
for(int i=index; i<n; i++) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
struct Node | |
{ | |
int data; | |
struct Node *next; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are many already existing powerful http servers that can be used in python e.g. gevent, twisted web server. However, they are a bit complex to use and you cannot start them in a thread other than the main thread. | |
Here is a sample of basic http server using "BaseHTTPRequestHandler". The example exposed two rest interfaces: | |
To ingest records into the web server | |
To retrieve already ingested records from the web server | |
The records are assumed to be JSON based, however, any type of records can be ingested. | |
[sourcecode language="python" wraplines="false" collapse="false"] | |
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer |