Want to get started with Data Structure
Basic DSA to learn
Hi there, remember me? It’s Rubics once again. here I am to discuss the basic data structures for my fellow mates.
The data structure is a particular method for storing and organizing data in computers in such a way to use it more efficiently.
Data structures are widely used in Software Engineering as well while programming.it is a very important as well as a needed topic for interviews and competitive competitions. I started learning DSA once I finished with my basics, depending on your project you need to use different data structures.
The question might arise in your mind why learn data structures? So, it helps as it consumes less time and memory and these both are very much important. during competitions they are helpful and you get many questions from there.
Here is a list of basic data structures I started with:
Arrays
If you want to store elements of the same data type you can use an array as An array is a structure that holds items of the same data type. It has a fixed length which cannot be after declaration. Each location has a numerical index which is used to identify the element.
Basic operations
- Traverse − print all the array elements one by one.
- Search − Searches an element using the given index or by the value.
- Update − Updates an element at the given index.
2. Stack
Stack data structure work on the Last In First Out (LIFO ) mechanism. It has many real-world examples like a pile of plates in a stack the last kept is used first.
In programming, it is applied in recursion and expression evaluation.
Primary operations:
Image
push() −
- storing an element on the stack.
- pop() − Removing an element from the stack.
3. Queue
The queue mechanism works on the First In First Out (FIFO)mechanism. It has one end to insert data and another end to delete data.
Primary queue operations :
· enqueue() −store an item in the queue.
· dequeue() — remove an item from the queue
note: it’s a complicated task to store and access elements in the array. So queue is used.
4. Linked list
If you have a sequence of data then a lined list is the one to use. It contains items in a sequence and each link has a connection with another. Other than array linked list is widely used.
image
Operations :
· Insertion − Adds elements at the beginning of the list.
· Deletion − Deletes the element at the beginning of the list.
· Display − Displays the complete list.
· Search − Searches an element using the given key.
· Delete − Deletes an element using the given key.
5. Trees
Trees in programming are just like the real ones. it has root, leaf, subtrees nodes.
A tree is a data structure that represents hierarchical data. Each node contains data.
image
Trees operations :
· Insert − Inserts an element in a tree/create a tree.
· Search − Searches an element in a tree.
· Preorder Traversal − Traverses a tree in a pre-order manner.
· Inorder Traversal − Traverses a tree in an in-order manner.
· Postorder Traversal − Traverses a tree in a post-order manner.
It is important to learn and accurately apply data structures. stay tuned with www.thecodepanda.in the next article for clear discussion and tune in to www,thecodepanda.in for practice questions and also for learning hardcore programming tips and tricks. Hope you liked this article.
We are excited to hear you. Connect with us for more and share your thoughts!
Happy coding !!