Skip to content

Instantly share code, notes, and snippets.

Given a set of distinct integers, S, return all possible subsets.

Note:

  • Use list as data structure
  • Do NOT use itertools
  • Sort your final results to get standard output (Not considered as the time complexity). For example sorted(result).

For example, If S = [1,2], a solution is:

@zhouzhuojie
zhouzhuojie / Summary
Created August 2, 2013 13:26
Former Ideas
List
--------------
* Statistics - MCMC
* Statistics - One long run vs Many short runs
* CS - Non-backtracking
* CS - Tree Sampling vs Graph Sampling
* Other things
@zhouzhuojie
zhouzhuojie / NBRW
Created August 16, 2013 15:17
Non-backtracking RW
Non-backtracking RW
=====================
Preview URL:
http://bit.ly/16U4JHf
Basic Idea
-------------
1. Push $P'(e_{ij}, e_{jk}) \geq P(j,k) $
@zhouzhuojie
zhouzhuojie / knock-client Readme
Created August 17, 2013 18:02
knockout-client
Knockout Client for Meteor
==============
[**Knockout**](http://knockoutjs.com/) is a JavaScript MVVM (a modern variant of MVC) library that makes it easier to create rich, desktop-like user interfaces with JavaScript and HTML. It uses observers to make your UI automatically stay in sync with an underlying data model, along with a powerful and extensible set of declarative bindings to enable productive development.
### Install
```bash
mrt add knockout-client
@zhouzhuojie
zhouzhuojie / knockout-client-pager Readme
Created August 17, 2013 21:07
knockout-client-pager readme
knockout-client-pager
==============
pager.js is a JavaScript library based on KnockoutJS and jQuery that provides the possibility of creating single page applications in a declarative fashion - nesting subpages inside subpages where each subpage can be developed standalone but still communicate between each other.
Combined with Meteor, pager.js provide us with a complete and robust client side routing framework. For more details, see pager.js official [demo](http://pagerjs.com/demo/).
### Install
```bash
@zhouzhuojie
zhouzhuojie / Experimental Results 8.23
Created August 23, 2013 05:07
Experimental Results 8.23
## Using random initial nodes
#### Divide the groups into two arbitrary groups
as733:
![](http://i1336.photobucket.com/albums/o641/00zzj/BTRW/nrmse_rseed_as733_zps6a3b9b04.png)
@zhouzhuojie
zhouzhuojie / 0826
Created August 27, 2013 02:59
Using random groups without memorized
## Using random groups without memorized
as733:
![](http://i1336.photobucket.com/albums/o641/00zzj/BTRW/0826/nrmse_nomem_as733_zps21527543.png)
@zhouzhuojie
zhouzhuojie / BTRW0828
Created August 28, 2013 04:00
Groups divided by degree
## Groups divided by degree
#### Procedure
1. Sort neighbors according to their degree
2. Divide these neighbors into first half and last half (i.e. a group of lower degree nodes and a group of higher degree nodes)
3. Jump from one group to another if possible
@zhouzhuojie
zhouzhuojie / Experimental results 8.31
Created September 1, 2013 03:18
Experimental results 8.31
## Experimental results 8.31
#### Graph explanation
Each point in the graph is the average of 5000 runs. It took about two days to generate one graph. Former results are only 500 runs.
#### Observation:
@zhouzhuojie
zhouzhuojie / Theory behind NBRW 9.2
Created September 2, 2013 19:50
Theory of NBRW 9.2
# Note
### Preliminaries
* Definition of asymptotic variance of the estimator $\hat{\mu_n}=\frac{1}{n}\sum_{t=1}^nf(X_t)$ is
$$V_{\infty}(\hat{\mu}) = \lim_{n\rightarrow\infty}nV(\hat{\mu_n}) $$
### 1) Peskun's theorem on modifying a reversible chain to avoid staying in the same state
_**Theorem 1 (Peskun 1973):** Let $X_1, X_2, \dots$ and $X'_1, X'_2, \dots$ be two irreducible Markov Chain on the finite state space $\mathcal{X}$, both of which are reversible with respect to the distribution $\pi$, and hence have $\pi$ as their unique invariant distribution. Let the transition probabilities for these chains be_