Learn Data structures from scratch-A success guide for better results

In this tutorial, we will discuss about data structures from the basics. We will understand the different types of data structures and their uses and how we can implement them.

What is data structure?

A data structure is a collection of data that can be stored in an organised manner so that the data can be accessed, modified efficiently.

Data Structures usages

  1. Data structures are used in different kinds of applications like relational databases, which use B-tree indexes to retrieve the data.
  2. Hash table is used in compiler design.
  3. These are used in different algorithms like searching, sorting.
  4. Internet indexing service uses data structures.

Types of the Data structures

Types of DSSub type
LinearArray
Linked List
Stack
Queue
TreeBinary Tree
Binary Search Tree
Heap
HashingHash Table
Hash Tree
GraphDecision Graph
Directed graph
Matrix

What is Linear data structure ?

A linear data structure is a type of data structure where data can be traversed sequentially. Array, Linked list, stack, queue are examples of linear data structure. Please go through below image for the details:

Linear data structures
Linear data structures

What is Tree Data Structure

A tree data structure is a hierarchical data structure. It has nodes that are connected by edges.Please go through below image for the details:

Learn Data structures from scratch-A success guide for better results
Example of tree

What is hashing

Hashing is a data structure which uses a hash function to map the data in a key-value pair to retrieve the data faster. Examples of Hashing are Hash table, Hash tree. Please go through below image for the details:

Learn Data structures from scratch-A success guide for better results
Example of Hashing

What is graph

A Graph is a non-linear, pictorial representation of data consisting of edges and vertices. Please go through below image for the details:

Learn Data structures from scratch-A success guide for better results
example of graph

Difference between linear and non-linear data structure

Sl NoKey pointsLinear data structureNon-linear data structure
1Data alignmentData gets stored  sequentially Data gets stored in hierarchy form
2LevelsSingle level involvedMultiple level involved
3ComplexityEasy to implementImplementation is complex
4TraversalData can be traversed in single runData cannot be traversed in a single run rather need multiple runs
5Utilisation of memoryNot efficientEfficient
6ExamplesArray, Linked list, stack, queueGraph, tree
7ApplicationUsed in software developmentUsed in Image Processing, Voice Processing, Artificial Intelligence 
Learn Data structures from scratch-A success guide for better results
DS flowchart

Some import Questions and Answers on Data Structure

Qn 1. What do you mean by ADT in Data structure?

Ans: ADT means Abstract Data type. Class or Objects are an example of ADT. When We use and Class or Object, we define the behavior by a set of values and a set of operations. ADT only tells us what operation has to perform. It does not tell us how the operation has been internally implemented.

For Example :

  • List
    • size() -> Size gives us the number of elements, but it does not show how internally it calculates to give the result.
    • insert(x) -> insert helps us to insert the element but does not tell how the logic is written.
    • remove(x) -> Similarly remove method is used to remove the elements without telling the implementation.
    • get(i) -> get is used to access the elements.

Qn 2. What are the advantages of data structure?

  1. Ans:
  2. Using Data Structure, we can efficiently store data in a storage device.
  3. Data structure gives an easy option to retrieve the data from a storage device.
  4. It can process small as well as large numbers of data efficiently
  5. Using data structures like graph we can solve real-life problems
  6. Database systems uses indexing using a hash table and array to retrieve the data efficiently.

Qn 3. What is primitive data structure?

Ans: Primitive data structures are system-defined data types supported by different programming languages. Example: int, double, float, boolean, character.

Qn 4. What is a Complex Data structure?

Ans: Data structures like Hash table, Tree, Heap, Graph are called a complex data structure. The implementation of these data structures is complex in nature.

Qn 5. What are the two main types of data structure?

Ans: Mainly, data structures are divided into two parts:

  1. Linear Data structure: Stack, Queue, Array, Linked List
  2. Non-linear Data Structure: Tree, Graph

Conclusion

Till now, We have covered the basics of Data Structure. In the next topic, we will write about the Array. For more details for this section, please refer to this link.

Cypress Commands and Cypress Custom Commands:HandsOn

Table of Contents What is Cypress Commands? UI Interaction commands provided by CypressCypress Right Click CommandCypress Double Click CommandCypress Click CommandCypress Trigger CommandCypress Type CommandCypress Select CommandCypress Check CommandCypress Clear CommandAre Cypress Commands asynchronous?Cypress Custom CommandsChaining Assertion commands in CypressOverwriting existing Cypress commandsCypress Chainable CommandsParent Custom Command in CypressChild Custom Command in CypressDual Custom Command…

Continue Reading Cypress Commands and Cypress Custom Commands:HandsOn

Step By Step Page Object Model in Cypress with Examples

Page Object Model, commonly known as POM, is a popular pattern in any automation framework. Page Object Model can be applied in Cypress too. Page Object Model has many advantages in creating a framework for test automation, such as reducing code duplication and increasing maintainability and readability. Cypress provides us the flexibility to incorporate Page…

Continue Reading Step By Step Page Object Model in Cypress with Examples

Cypress Promise and Cypress Asynchronous: Hands-On Implementation, Example

In our previous article, we saw the configurations in Cypress and various options that can be configured in JSON files. This article will understand Cypress Promise and Cypress Asynchronous behaviour with hands-on implementation and examples in our project. We will also discuss how to incorporate awaits in our asynchronous code and some essential functions like wrap()…

Continue Reading Cypress Promise and Cypress Asynchronous: Hands-On Implementation, Example

What is Cypress Json: Example, Schema, Detailed Hands On Analysis

We will discuss the JSON structure, examples, and detailed hands-on experience to write JSON in our code. But, first, let’s dive into our article! What is Cypress Json: Example, Schema, Detailed Hands-On Analysis In our previous article, we discussed variables and aliases and how to write our first test case. Now, we will discuss Cypress JSON…

Continue Reading What is Cypress Json: Example, Schema, Detailed Hands On Analysis

Cypress Example: Open Cypress, Variables, First Test Script

In the last article, we saw what Cypress is, its architecture, the installation process, and the pre-requisites required for the installation. However, before we begin writing our tests, we need to install Cypress. Click here to get the detailed steps to install Cypress. Cypress Example This article will discuss the Cypress example, JSON examples, variables and aliases,…

Continue Reading Cypress Example: Open Cypress, Variables, First Test Script

About Himadri Das

Learn Data structures from scratch-A success guide for better resultsHi, I am Himadri Das, I am a blogger, and an open source contributor. I have about 11 years of experience in the Information Technology domain. Currently I am working in a Startup Company as Quality Assurance Manager. I have hands-on experience on Appium, Selenium, QTP, Locust, Automation framework, Performance Testing, Functional Testing, Java, python, Shell scripting, MySql, Redis, Kafka etc. Apart from my work and writing blogs, I love to play guitar, love to travel and love to watch cricket and football. If you want to know more about me, please visit my linkedin profile - https://www.linkedin.com/in/himadri-das-2b6b7421/.

x
About Lambdageeks
en English
X