Skip to content

Instantly share code, notes, and snippets.

View santanub's full-sized avatar

Santanu Bhattacharya santanub

View GitHub Profile
@santanub
santanub / algo.rb
Last active February 28, 2016 14:21
6. Write a recursive function to compute the number of sequences of n binary digits that do not contain two 1s in a row. (Hint: compute how many such sequences exists that start with 0, and how many exists that start with a 1)
## Problem no 6 recursion
class Algo
def count_binary_count_rec(n)
if n == 1
return 2 ** n
elsif n.zero?
return 1
else
count_binary_count_rec(n-1) + count_binary_count_rec(n-2)
end
@santanub
santanub / elasticsearch.text
Last active May 18, 2016 11:55
ElasticSearch
Installing elasticsearch
1. Visit https://www.elastic.co/downloads
2. Download zip version. Unzip it.
3. Run bin/elasticsearch
4. Visit http://localhost:9200/. If it return status 200, it is succesfully installed.
Elasticsearch uses JavaScript Object Notation, or JSON, as the serialization format for documents. JSON serialization is
supported by most programming languages, and has become the standard format used by the NoSQL movement. It is simple,
concise, and easy to read.