WHAT ARE DATA STRUCTURES? | DIFFERENCE BETWEEN STACK AND QUEUE | NOOB CODE PRO

 INTRODUCTION:

Hello there, how is it going? I hope you are doing great. Welcome to another lesson from NCP. In this article, we will be discussing about data structures, what they mean, how to use them and some practical applications of them. Let us get started with our today’s lesson .

TYPES OF DATA STRUCTURES:

A data structure is a format used to store and organize information. List, tuples, dictionaries are some data structures you are already familiar with.

Let us take a look at some of the well know data structures:

  1. STACKS:

Stacks are similar to lists, like lists you can add or remove an item, but unlike lists, you can only add or remove the last item. Adding an item to a stack is called pushing and removing an item from a stack is called popping. It is a LIFO (Last In First Out) data structure which means the last added item is the first one to be removed. Whatever we put in a stack comes out in reverse order. A stack is really useful in solving problems like reversing a string. 

Let us take a look at an example, where will create a simple python program named ‘stack.py’ and create a ‘Stack’ class of our own, which can be used to create and work with stacks:


  1. QUEUE:

A queue is a FIFO (First In First Out) data structure. Think of it as a line of people waiting to buy a movie ticket. The first person in line is the first one to get the ticket. Similar to stacks, queues have lists as their basic structure. Basically, the order of input is the same as the order of output.


CONCLUSION:

Both of these data structures are really useful in solving problems which includes adding or removing the first or the last element in a list. I hope you find this really helpful, if you did, dropping us a like is one way to show us some appreciation;). Share your opinion with us in the comments below. If you loved this lesson, share this with your programming buddies. Follow our blog for more programming content every week. 

You can play a lot with these two data structures, share some of your ways to use these data structures by leaving a comment below. 

Have some queries or questions? You can always find me in the comments section, telegram channel or my Pinterest profile where you can personally talk to me and ask me questions about anything we have learnt so far.

If you are looking to join a community of programmers, you can join Noob Code Pro’s official telegram channel for free. 

Stay tuned for another article next week, same time, where we will discuss about a new topic/concept in programming, what they are, how they work and where you use them. More cool stuff coming your way, DON’T MISS IT !! And I'll see you next week. Goodbye and Good Luck :)

I hope this article answered all of your questions and even helped you in becoming a better programmer. FOLLOW NOOB CODE PRO TO BECOME A PROFESSIONAL PYTHON PROGRAMMER FROM A TOTAL BEGINNER.

https://images.pexels.com/photos/684385/pexels-photo-684385.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500


If you are a beginner, intermediate, advanced or just someone interested in programming, feel free to join our telegram channel and be among people like you:


And do you know the best part? Joining it is FREE !!!


So go ahead click on the link and I will see you there. 


You can contact me personally through my email: code2learnofficial@gmail.com


or


my pinterest profile


HOPE YOU HAVE AN AWESOME DAY AHEAD !!!


Post a Comment

0 Comments