Brief introduction to STL in C++

The Standard Template Library (STL) is a library that provides facilities regarding common algorithms and data structures like stacks, queues, lists and vectors.
There are three components of STL :-
1) STL use different containers to facilitate programmer with data structures. some of the most frequently used containers are :- 

  • vector (behaves like a dynamic array)
  • list (behaves like doubly linked list)
  • set (ascending container of unique elements)
  • hash_map
  • queue
  • deque (double-ended queue)
  • stack

2) Algorithms in STL :-

  • swap(a, b)
  • min(a, b)
  • max(a, b)
  • sort(begin, end)
  • binary_search(begin, end, value)
  • accumulate(begin, end,init) (counts the sum of the elements)

3) Iterators in STL :- Iterator is an object that traverse a container class.

  • container::iterator (read-write operator)
  • container::const_iterator (read only iterator)

TRIE (Data Structure)

TRIE (pronounced as tree or try) is used to store data having a key and a value. It is used to store large dictionaries. For example, if the words are about, above, base, bake. The TRIE would be as following :-


Suppose we want to store Name of person with their salary, which are, amy 1000, aby 1200, ana 900. It will go like this:-

Microsoft Interview? Don’t forget to revise these most commonly asked Microsoft interview questions!

1) Check whether given binary tree is BST or not?
 * Hint :- Do an In-order traversal. If it is sorted, tree is Binary tree.

2) Give algorithm for in-place removing of duplicates from a string.
* Hint :-
1) Sort array. (O(n logn))
2) Scan and eliminate consecutive identical elements.

3) Algorithm for Run-length encoding.
* Hint :-
1) Take first character of the source string.
2) Append to destination string.
3) Count number of the selected character in the source string. Append the number to destination string.
4) Pick next character and repeat steps 1,2 and 3. (check condition that character is not already selected)

4) Check if there is a loop(cycle) in a linked list. If there is one find the length of the loop as well as the starting point of the loop.
* Hint :- Take two pointers “p1” and “p2”. p1 should move one step further, while p2 should move two steps further, while both does not meet or any of them does not point to null. If they meet, there is a loop.
To find length of the loop, when they meet, send one of the pointer to HEAD. Now, each pointer should move one step forward and each step should add a one to counter(start counter from zero). When the both the pointers meet, value of counter is length of loop. And, the point where they meet, is the starting of loop.

5) Find the LCA(Lowest Common Ancestor) of given nodes in a binary tree.

* Hint :-
1) Store path from node one to root node in an array or a vector.
2) Store path from node two to root node in an array or a vector.
3) Traverse both path till you get same values.

Why you should start before you are ready?

“If you will wait for the time, it will never come.
Make ‘now’ the time, and you will never have to wait for it.”

A few days ago, I challenged myself with a task I knew(read believed) I couldn’t complete. I did complete. It boosted up my confidence. I started doing it regularly. In a couple of days, I became pro. Because, the moment you take a step forward, you become ardent about the thing. And this ardency will create atmosphere around you so that would want to complete the task.

There are many ways you can ensure yourself being one step ahead of everyone else. One of them is being ahead of others. And, one upper level of being ahead from others is being ahead of yourself. Which you can say, is, starting before you think you are ready. Look forward for some reasons why you should get started as early as possible…

1) You lose less.

By being an early starter, you can make sure that you don’t lose as much as you might have lost if started late. Waiting for yourself getting ready will keep you in a loop. Loop of thinking you will improvise yourself to be ready and procrastinate. Procrastinate and hoping for getting improvised. Loop will end you up with a great amount of loss of time, affecting greater amount of loss of resources.

2) Because, by the time you will feel ready, it will be too late.

Remember? The Idiom? exactly!
There are thousands of other people already doing what you are trying to do. Hundreds of people getting added daily. Being early gives you the opportunity to be ahead of this hundreds. If you decide to wait, to get the feeling of being ready, those thousands along with the daily dose of hundreds will prove that you’re too late.

3) It gets you out of your comfort zone.

Sitting on your couch, reading articles on Internet don’t make you any better. What makes you better is DOING! Waiting for the perfect time, provides you a reason for sitting in your couch being lazy and keep planning for your future. But, Starting early will make you get up from your couch, push your lazy boundaries and work!

4) Taste Failures (Fail before there is no time left to fail)

“It’s failure that gives you the proper perspective on success.” – Ellen DeGeneres.
The way I see a failure, it is an opportunity of getting to know how the work should not be handled in future. Only the one who has started early, and tasted failure while in early period, would be knowing what not to do while in critical period. Whereas, ‘waiters’ will confront failures when they are expected succeed.

Start doing that thing you’re stalling off. Don’t let yourself procrastinate in the name of  not being  ready. You are ready! What you need to do is, take action!

Things to do before you graduate with a computer science degree!

  • Prepare for Entrance exam of post degree.( for me, it is GATE )
  • Do an Internship.
  • Participate in Google Summer Of Code.
  • Participate in Competitive Programming.( various competitions like Google code Jam. sites like TopCoder, Hackerrank, Codechef)
  • Do some Certifications:-
    1) Microsoft certifications by MVA.
    1) Google Adwords.
  • Contribute to Open source.(Github)
  • Solve some Practical problems/Make Projects  (For me, Make tutorial site/channel)
  • Publish Research paper.
  • Make
    1) Technical Blog
    2) Resume site(Ruby on rails/Django)
    3) Mobile Application
    4) Web App
  • Answer on StackOverFlow
  • Answer on Quora
  • Visit sub-reddits of computer science on Reddit. 
  • Watch
    1) Competitive programming by Steven skiena
    2) Algorithm Analysis by Steven skiena
  • MOOC
    1) Algorithm (MIT)
    2) Stanford algo1, algo2 on Coursere
    3) CS50
  • Read
    1) Cracking the coding Interview by Gayle Laakmann McDowell
    2) Programming pearls by Jon Bentley
    3) The Algorithm design manual (Steven skiena)
    4) CLRS
  • Attend
    1) GDG Meetups
    2) Quora Meetups
    3) Hackathons
    4) Programming challenges
  • Learn
    1) Web-framework
    2) Web-scarping
    3) using Linux
    4)Unusual Language(Python/Haskell/Scala)
    5) Bash
    6) Google adwords

Spend your precious time on internet productively!

In this advanced era, getting some sort of information is just one click away from you. The internet lets you see the information from every aspect. But, how to get information in the best way is upto you. So, here are some sites listed which will help you spend your time on the internet “The productive way”.

1)  Ted

As its slogan says, “Ideas worth spreading”, the site owned by a private non-profit foundation offers videos to view online. The videos are global conferences on topics related to technology, entertainment and design. Some of the famous TED speakers includes Bono, J. J. Abrams, Bill Gates, Jane Goodall, and Stephen Hawking. Here is the link to some of the best ted-talks(Top 20 TED Talks That Can Improve Your Life).

2) Quora

* Personal favourite

Quora is a question and answer website, where you can ask questions, answer them as well as edit them. You can get best of the web on any topic here. And, the best thing about Quora is you get smart answers. I’ve also seen cases where the founder of Wikipedia, founder of Quora, Product designer of Facebook messenger, CEO of Netflix answered questions related to their topics, Which makes Quora a great platform to use. Here is the link to the best answers on quora.(271 Best Answers on Quora)(Go and fall in love with Quora!)

3) Duolingo

There are millions of people around the globe who can’t get better educational or job opportunities because of not knowing of some particular foreign language. Duolingo is there to help those people out. It is a free language learning platform offering Latin American Spanish, French, German, Brazilian Portugese, Italian and Dutch for English speakers as well as American English for Spanish, French, German, Portuguese, Italian, Dutch, Russian, Polish, Turkish, Hungarian, Romanian, Japanese, Hindi, Indonesian, and Korean speakers. Duolingo is available on ios, android and on the web platform. The best thing about Duolingo is that the information is taught in such a way that it becomes very easy to learn.

4) Codecademy

“Codecademy is an education company. But not one in the way you might think. We’re committed to building the best learning experience inside and out, making Codecademy the best place for our team to learn, teach, and create the online learning experience of the future.” Says the team of codecademy about themselves. You can learn many skills like html & css, javascript, jquery, Python, ruby, PHP and  many API’s on Codecademy.

5) Calm

The way our lifestyles are, we always are in hurry. But, it’s necessary to take out some time to step back and relax. This site called helps you get relaxed by listening to some sort of relaxing music with many function.

6) Marc and angel 

* Personal favourite

This site gives you the best of “Inspirational advice and practical tips for life”. As stated by the writer Marc and Angel, the site currently contains over 600 articles on happiness, productivity, emotional intelligence, relationships, and general self-improvement. And has attracted over 100 million page views and 100 thousand subscribers since its inception in 2006.

7) Mathway

Mathway provides students with the tools they need to understand and solve their math problems. With hundreds of millions of problems already solved, Mathway is the number 1 problem solving resource available for students, parents, and teachers. All the types of math problems like Basic Math, Pre-Algebra, Algebra, Geometry, Trigonometry, Precalculus, Calculus, Statistics, Finite Math, Linear Algebra could be solved here.

8) Dumb little man

* Personal favourite

This website contains articles full of awesome tips and advice. Each article on this site is so productive that, each one can change your life.

9) Lifehacker

As the name says, this is a website on software and personal productivity tips which helps you work smarter.

10) Lifehack

Being a Guest writer at, I can say that if there is a site on Internet which can make you addict by reading just one article on site, it has to be this. Trust me, try it! My article (

Some bonus links :-

1) – Quickly capture effective notes.

2) – Write a note to someone that will self-destruct after they read it!

3) –Scan any suspicious file or email attachment for viruses.

4) Mind tools – A blog that teaches you practical career skills.

5) –Share big files online.

6) Time Zones– A less confusing view of the world time zones.

7) – Create mind-maps, brainstorm ideas in the browser.

8) – A random-chat website that you’ll definitely enjoy

9) – Relax with the sound of rain.

10) –  Send yourself an email at any date up to 30 years in the future.