An XMPP BOSH & WebSocket server (connection manager) written using node.js in Javascript
Project Home Page: https://github.com/dhruvbird/node-xmpp-bosh
Please see whats_changed.md
| #include <iostream> | |
| #include <stack> | |
| using namespace std; | |
| struct TreeNode { | |
| int val; | |
| TreeNode *left, *right; | |
| TreeNode(int v): val(v), left(nullptr), right(nullptr) {} | |
| }; |
| #include <iostream> | |
| using namespace std; | |
| // Counts numbers from 0 to n-1. | |
| struct Counter { | |
| int i = 0; | |
| int n; | |
| bool first = true; // Tracks if this is the first invocation of the next() function | |
| Counter(int _n): n(_n) {} | |
| int* next() { |
| #include <iostream> | |
| #include <stack> | |
| using namespace std; | |
| // Counts numbers from 0 to n-1. | |
| struct Counter { | |
| int i = 0; | |
| int n; | |
| bool first = true; // Tracks if this is the first invocation of the next() function | |
| Counter(int _n): n(_n) {} |
| def unionRanges(intervals): | |
| intervals = sorted(intervals) # Sort by elem[0] | |
| ranges = [ ] | |
| if len(intervals) == 0: | |
| return [ ] | |
| start = intervals[0][0] | |
| end = intervals[0][1] | |
| for i in range(1, len(intervals)): | |
| if intervals[i][0] < end: | |
| end = max(end, intervals[i][1]) |
| /* Compile and run: | |
| * | |
| * g++ -std=c++0x InPlaceMergeNsqrtN.cpp && ./a.out 23 | |
| */ | |
| /* Merges 2 sorted arrays of size N and sqrt(N) in Theta(N) time | |
| * | |
| */ | |
| #include <iostream> | |
| #include <vector> |
| # Columns: | |
| # log(N) N Time/Iter(usec)[std::lower_bound] N Time/Iter(usec)[l2search] | |
| 23 8388608 0.460176 8388608 0.269376 | |
| 24 16777216 0.621821 16777216 0.435599 | |
| 25 33554432 0.735565 33554432 0.615605 | |
| 26 67108864 0.856156 67108864 0.598811 | |
| 27 134217728 0.959821 134217728 0.636344 | |
| 28 268435456 1.552199 268435456 0.771024 | |
| 29 536870912 1.158228 536870912 0.818436 | |
| 30 1073741824 1.936374 1073741824 0.905859 |
| """ | |
| Problem statement: | |
| ------------------ | |
| Given a number 'n', design an algorithm that will output the smallest | |
| integer number 'X' which contains only the digits {0, 1} such that | |
| X mod n = 0 and X > 0 | |
| (1 <= n <= 100000) | |
| """ | |
| def solve(n): | |
| if n < 2: |
| def merge_sort(msg, m, depth=0): | |
| print " " * depth, msg, m | |
| result=[] | |
| #Exit condition | |
| if len(m) < 2: | |
| return m | |
| mid = int(len(m)/2) | |
| left = m[:mid] |
An XMPP BOSH & WebSocket server (connection manager) written using node.js in Javascript
Project Home Page: https://github.com/dhruvbird/node-xmpp-bosh
Please see whats_changed.md
| webserver: webserver.c libuv/uv.a http-parser/http_parser.o | |
| gcc -I libuv/include \ | |
| -lrt -lm -lpthread -o \ | |
| webserver webserver.c \ | |
| libuv/uv.a http-parser/http_parser.o | |
| libuv/uv.a: | |
| $(MAKE) -C libuv | |
| http-parser/http_parser.o: |