Sunday, September 27, 2020

Stack(Abstract Data Type): A Quick Overview

Stack


Stack is an abstract data type. It’s underlying data structure is an array or linked list.

Stack works on the concept of “Last In First Out” or “First In Last Out”


Let’s understand the concept of stack by an example. We have a bookshelf and 10 different books. How do we keep the books on the bookshelf? One book on top of another book. So, This way the last book will always be kept on the top. So If we want to get any book we have to take the top book first. Then, the next book will be taken off. Following this, the last book will be the same book that has been kept at first.


The basic operation of stack are: push(), pop() and peek()


Push operation:

The push operation puts the item to the top of stack. It’s very simple and can be done in O(1).



Pop operation:

The pop operation takes out the top item from the stack. It’s also a simple operation and can be done in O(1).



Peek operation:

The peek operation returns the value of the top element of stack. It does not take out the element from the stack. Stack remains as it is. It’s very simple and can be done in O(1).



stack.push(10)







10


Stack


stack.push(20)






20

10


Stack


stack.push(30)





30

20

10


Stack


stack.pop()

=30





20

10


Stack


stack.peek()

=20





20

10


Stack



  • Illustration of push, pop and peek operation



Application of Stack:

  • In the DFS algorithm, stack works as an underlying data structure.

  • Finding strongly connected components in a graph

  • Finding Euler-cycles in graphs.


Implementation in Python / Java will be here

Monday, August 27, 2018

What It Feels Like Being A Student of NIT Running On Temporary Campus.

Being a student of an Institute like NIT is an honour itself. But It seems so to outer world. Because the reality is quite different from it. I personally realized it, felt it - "How it feels like living in an institute having no permanent campus. Like all other NIT, NIT Sikkim is also an Institute of national importance, run by central government and funded by MHRD. But Somewhere I feel that this NIT has been given lower priority than other. Because Firstly, It has been allocated to a remote place(Ravangla), where there is no basic facilities like - medical, transport, food etc. available. Secondly, It has been started in 2010 along with 9 other NITs. But almost all other NIT have got their permanent campus. Infact the newer NIT like NIT Andhra Pradesh established in 2015 have their permanent campus today. Then why only NIT Sikkim is left back in this race. Here the condition of Hostel is also miserable. We have to live upto 5 students in a small room which tends to study problem and noise problem. If I expose to Academics, due to temporary running campus, the classes are  not that much enough to run academics comfortably. Sometimes it happens that the students go to class and find some other class running there, they have to wait. So now you can imagine - " How it feels like living in such institute. So all the students are on strike, hampering their academics for permanent campus. Voices are rising on twitter like "WE WANT PERMANENT CAMPUS.", "WE WANT JUSTICE." and so on along with hashtags like - #TheHomelessNIT, #NotInRavangla, #NoMoreDelay etc. So you can see all the students have burning desire for getting Permanent Campus.
Lastly, I would like to quote -
"Na Sangarsh, Na Takleef,
To Kya Maja Hai Jeene Me"
 "Bade-Bade Toofan Tham Jate Hai,
Agar Aag Lagi Ho Seene Me."

       We won't quit until we get permanent campus.


Sunday, June 24, 2018

How to Spend Summer Vacations..


Summer Vacation is a period of vacation during summer season, in which every school offers students as well as faculty members a long vacation time up to 4 to 6 weeks and varies according to the location. So, This is most probably the happiest time in a student's life. It basically starts in last May and covers whole June, because June is the hottest month. These vacation are long time that can be utilized for a lot of activities like taking up a dance class or an art workshop, learning a new language, taking up a job for professional experience. So there are a lot of activities to choose from depending upon varied interests and capabilities. But This is very much important to select the right activity according to your interest instead of following others. These activity also varies from age to age. Let's assume If you are too younger, you can't get job, internship.So what can be done is you can either educate your little brothers, sisters, or society kids or you can take up admission in dance class or art class. But All you need is you have to choose your hobby and make your hobby to a passion.





Here is a list of activity that can be done on Summer Vacation :-

1.) Go to a yoga class :-
 It sounds a little strange. Yeah, might be. But there is a tons of benefit of yoga. If you are really tired of studies and need some quality time to freshen yourself, then yoga is the best option. But It requires high motivation to do yoga daily. So what you can do is just make a group of your friends then try out a yoga class. The best thing about yoga is you don't have to go to classes, you can join online classes. Making a group makes you and your friend always motivated. You can give challenges to each other to do some particular yoga. But you should be careful while trying any difficult pose.

2.) Volunteer for a cause :-
 In this large growing population, there are many people who need your help. Volunteering for various social causes is becoming a great trend as well as passion among the people today. So your little effort can change the other's life forever. You can volunteer for like -  "stopping child labour", and a lot more other topics. Even you can go to rural areas and starting volunteering to encourage child to study. And believe me this attribute is going to help you in the future. It will create a leadership talent within you.

3.) Take your hobby and make it passion :- 
As already told earlier, Hobby is that kind of thing which never lets you feel bored. So when you give extra effort to your hobby it becomes your passion and when you have a great passion towards something, there's great chances of getting success. But Always remember to follow your hobby and stop following others. So look into depths, take times and then find your hobby.

4.) Do Some Internship :-
Many of us have heard about internship. You're not going to be paid for internship. It gives you an experience of working, taking risk and handling problems. Taking more and more internship makes you easy to get jobs. Because a company always want to hire a trained, experienced person who can get their work done easily. It's very crucial for Job. So, Again do internships of your interest and excel your work experience.

5.) Go for a trip :- 
You can enjoy your vacation exploring the natural world by spending some quality of time. It puts you out of your comfort zone, and force you to see yourself in a new way. It gives us a pleasant feeling, makes get rid of monotony, and makes you energetic. So when you come back to trip you have extra energy for your work. Also it increases your knowledge. You know new things about the world.

So these are the stuffs that can be done on your summer vacation. But don't sit idle, stay indoors and play video games, watch T.V and surf Internet too much. Don't get addicted to any bad habits. Avoid sleeping too much which is going to make you sloth. 

Happy Summer!!

Saturday, June 23, 2018

Sometime Luck Favors !!

That time I was in the 5th standard. I had just finished the annual exam of 4th std. After the Result publication, There happens summer vacation like all other schools and in these vacations our school goes to some visiting places for 3 to 5 days. This time school is going to visit Sikkim. But We have to pay for these vacation tour. On the result declaration day I opted the 1st position not only in my class but the entire school. My parents were very happy and feeling proud of me. So after that I requested my mom to allow me for tour. She replied "Why don't you ask your dad?" I was feeling very nervous to go to Dad and convince for allowing me for that tour because I was from a middle background family. But somehow I went to my dad and I was just going to ask my dad, before that he told me that Son, I heard about your school tour for Sikkim. I was thinking that you should also go with your friends and teachers. That was a very enthusiastic moment for me. And I went for a visit to Sikkim. After going there, We visited a lot of places there. I loved Sikkim a lot. That time I was thinking that If would here for a couple more days. After the vacation time passed, we came to our home place. Time passes by, I completed my 10th std. I took science in 11th std and started preparing for "JEE Mains and Advanced" Exam. Somehow, I passed in JEE Mains in 2017. And after counselling I got NIT Sikkim for my undergraduate course (B.Tech). Now I am in Sikkim and enjoying the beauty of Sikkim. On the very first day of my class walking on the road I remembered that day of my school tour and realized that "Sometime Luck favors.
Sikkim's cloudy scene
Nature