Skip to main content

Posts

HTTP 2 and How does it matters

Since a decade or so we have been using HTTP 1.1 for all kind server requests in application layer.There are a lot of latency issues when we used that for our traditional request response approach and the only thing we have found is hacks around this old HTTP 1.1 to suffice or solve a particular problem. Hence that created a need for new version of HTTP which addresses all these issues at foundational protocol level. I have been reading and exploring this a lot lately and have some useful things listed out as I explored it and can help even a beginner figure out HTTP 2. HTTP 2 SPDY  is a networking protocol introduced by Google in 2009. Its aim was to decrease web latency(time interval between request and response) and increase security. HTTP/2 is a clone of SPDY. Google has now stopped developing SPDY and started working on HTTP/2 with the same ideas of SPDY. HTTP2 is a binary protocol where as HTTP1.1 is an text based protocol  Here is a simple explanation t...

Write a program such that given a BST,return the size of largest subtree that lies within a given range[a,b].

Write a program such that given a BST,return the size of largest subtree that lies within a given range[a,b]. N.B: This  exact question was asked in a Google interview.  This problem when looked at first looks simple and may be for some it it but for me when it wasn't because when I started coding it I got all confused between recursions and the flow the algorithm will take.So i started simple on pen and paper tried for a couple of hours and could make it work . Point to be noted here is that the following approach here I took is not the most  efficient way but yes it does works perfectly. Steps or rather my thoughts : I had to touch each node so that I can calculate the size of the subtree in case the tree below and the node itself lied in the range.And after i calculate it I have maintained a global variable that stores the current max and when new value comes it compares it with existing one and updates it with the max value between them. To...

Graphs - DFS

Its been a while I posted because I had been busy with other stuff.From now on i would be posting basically what I learn and how I implement it in my journey of preparing for the best interviews. Now I am going to implement GRAPH DFS algorithm. Graphs as we all know many people tend to fear as we implement but once you start  realising  the underlying beauty and power of the data-structure, you can not hold yourself implementing it. Graphs can be represented as 2 ways: Adjacency lists or Adjacency matrices. Here I use adjacency list because as i am using java it pretty easy to implement it using Collections framework. DFS is pretty simple : Start with a node timestamp it and go deep and deep until u cannot go anywhere and then timestamp it. Finally you would end up creating a forest of multiple trees(Starting nodes). Code below is self explanatory and if any one has any queries please let me know. And the algorithm is direct implementation of book by Corm...

Linked List using PYTHON

This is a gentle intro into data structures using python.This is my personal learning experience and to take a note of what i am learning.Please feel free to comment In this post I have tried to implement a simple Linked List using Python. First I have created a file named LList.py which will contain the following code.Then i would be using this as a module in my main file to create a implementation using these #Single node creation class class Element:     def __init__(self, x):         self.data = x         self.next = None #Linked List implementation class class LinkedList:     def __init__(self):         self.head = None         self.tail = None     def append(self, x):         e = Element(x)         if self.head is None :             self.head = e ...

Git Cheatsheet [Commonly used commands]

In this post I have made a cheat-sheet of commonly used or most frequently used git commands .Just to make you feel about  git commands I referred this post  first rather than the post about setting git.I would be covering that in my next post.So you don't have have to worry.It will be a step by step procedure. Please feel free to comment if you have any doubt or want me to add something else.I would be happy to help you. CHEAT-SHEET Cloning a repository : git cone <ssh-path of the repository> Creating a branch : git branch <branch name> // This will make a new branch that will have all contents and commits of the current branch you are in right now. Changing branches (Moving form one branch to another): git checkout <branch name> Deleting a branch: First checkout to some other branch using the previous command.Then use git branch -d <branch name to be deleted> Showing the list of files being tracked (Both staged and un...

Introduction to GIT and GITHUB

In this series I would be covering the basic operation of  GIT so that even a new comer can easily feel comfortable with the terminologies and usage of git system. The first post is just a brief introduction that will help you clarify the questions raising about this new thing. What is a Git? Git is simply a software that helps you manage your source code.That means each change that you make to a source code is recorded in its history.So it can also be called as Source Code managemnt system. To use git for a particular project all you need is to initialize the current project folder so that it will be tacked by the git system.I will show it in further documents about how to do it. Every Git working directory(or you can say your project folder) is a full-fledged repository with complete history and full version tracking capabilities, not dependent on network access or a central server. What is GitHub ? In layman terms you can think ...