The DSA full form is Data Structures and Algorithms. It is the combination of data structure and algorithms which are used in a programming language to solve any problem statement. DSA can be used in any programming language. So let us understand this two words Data structures and Algorithm accordingly:
1. Data Structure:
A data means some values or an input and structure means a place to store the values. These two words together make data structure. It is a way to store and organize data in our computer so that we can easily access or modify the data efficiently. To store and organize the data we use some of the data types such as arrays, linkedlist, stacks, queues, trees and graphs. We understand each of them by a small example.
2. Algorithm in DSA:
An algorithm in DSA is the step by step or a sequential procedure to solve a problem . Algorithms are used to perform specific tasks like searching, sorting or processing the data into the data structures.
An Array is not a primitive data type , it is a collection of elements of the same data type. This data is stored in contiguous memory locations. It has a fixed size as the size is defined at the time of declaration. The data from tha arrays is accessed using indices. To get started with DSA Array is the most important topic to cover.
Assume an array as a train which has fixed compartments where each compartment has a specific number and stores people in an order. The array works similar to it as it has fixed size and it works sequentially.
Example of array in DSA:
Advantage and Applications of Arrays:
A linked list is a sequential format of nodes where each node contains data and an address (pointer) to the next node of the linked list. There are three types of linked lists such as singly linked list, doubly linked list, circular linked list.
Real world Example of Linked List in DSA:
Assume you are playing a game similar to treasure hunt , you get the clue which contains the location of the next clue. Similarly in the linked list the node contains the address of the next node.
Example:
Imagine a playlist of your favorite singer. Each song contains the name of the song(assume data) and a link to the next Song. you can navigate the next song through the first song but can’t directly jump to any song without starting from the beginning.
Visual representation:
Song1 -> Song2 -> Song3 -> NULL
A stack is a data structure which is also called a linear data structure. It follows a principle that Last in first out (LIFO) means the data which we put in the last will be removed first. It contains some operations such as Push to insert the data , pop to remove the data, and Peek to view the data at the Top of the stack.
Example of Stacks in Data Structures and Algorithms:
Assume you own a Phone Shop which contains a stack of phone boxes where you can only take the top phone box it represents Last in First Out.
Basics
Data Structures
Algorithms
Problem-Solving Practice
Mock Interviews
Must Read: What is DevOps?
Are you stuck on your sofa with a packets of tissues? Is your head heavy…
You can find updates on the episodes of the popular Indian television drama, Yeh Rishta…
Aditi Mistry the trending name on Instagram and other social media. Aditi Mistry a new…
DevOps means [Development and Operations]. It is software development combined with an IT operations automation…
Social media marketing is known as the pillar of online business as it's the most…
Shalini Passi is a trending name on social media. She got much attention after appearing…