13 Interesting Data Structure Projects Ideas and Topics For Beginners [2023]

13 Interesting Data Structure Projects Ideas and Topics For Beginners [2023]

  In the world of computer science, understanding data structures is essential, especially for beginners. These structures serve as the foundation for organizing and manipulating data effectively. To assist newcomers in grasping these concepts, I’ll provide you with data structure projects ideas for beginners . These projects are tailored to offer hands-on learning experiences, allowing beginners to explore various data structures while honing their programming skills. By working on these projects, beginners can gain practical insights into data organization and algorithmic thinking, laying a solid foundation for their journey into computer science. Let’s delve into some exciting data structure projects ideas designed specifically for beginners. . These projects are tailored to offer hands-on learning experiences, allowing beginners to explore various data structures while honing their programming skills. By working on these projects, beginners can gain practical insights into data organization and algorithmic thinking, laying a solid foundation for their journey into computer science. Let’s delve into some exciting data structure project ideas designed specifically for beginners.  

You can also check out our  free courses  offered by upGrad under machine learning and IT technology.

Data Structure Basics

Data structures can be classified into the following basic types:

  • Linked Lists
  • Hash tables

Selecting the appropriate setting for your data is an integral part of the programming and problem-solving process. And you can observe that data structures organize abstract data types in concrete implementations. To attain that result, they make use of various algorithms, such as sorting, searching, etc. Learning data structures is one of the important parts in data science courses .

With the rise of big data and analytics , learning about these fundamentals has become almost essential for data scientists. The training typically incorporates various topics in data structure to enable the synthesis of knowledge from real-life experiences. Here is a list of dsa topics to get you started!

Check out our Python Bootcamp created for working professionals.

Benefits of Data structures:

Data structures are fundamental building blocks in computer science and programming. They are important tools that helps inorganizing, storing, and manipulating data efficiently. On top of that it provide a way to represent and manage information in a structured manner, which is essential for designing efficient algorithms and solving complex problems.

So, let’s explore the numerous benefits of Data Structures and dsa topics list in the below post: –

1. Efficient Data Access

Data structures enable efficient access to data elements. Arrays, for example, provide constant-time access to elements using an index. Linked lists allow for efficient traversal and modification of data elements. Efficient data access is crucial for improving the overall performance of algorithms and applications.

2. Memory Management

Data structures help manage memory efficiently. They helps in allocating and deallocating memory resources as per requirement, reducing memory wastage and fragmentation. Remember, proper memory management is important for preventing memory leaks and optimizing resource utilization.

3. Organization of Data

Data structures offers a structured way to organize and store data. For example, a stack organizes data in a last-in, first-out (LIFO) fashion, while a queue uses a first-in, first-out (FIFO) approach. These organizations make it easier to model and solve specific problems efficiently.

4. Search and Retrieval

Efficient data search and retrieval are an important aspect in varied applications, like, databases and information retrieval systems. Data structures like binary search trees and hash tables enable fast lookup and retrieval of data, reducing the time complexity of search operations.

Sorting is a fundamental operation in computer science. Data structures like arrays and trees can implement various sorting algorithms. Efficient sorting is crucial for maintaining ordered data lists and searching for specific elements.

6. Dynamic Memory Allocation

Many programming languages and applications require dynamic memory allocation. Data structures like dynamic arrays and linked lists can grow or shrink dynamically, allowing for efficient memory management in response to changing data requirements.

7. Data Aggregation

Data structures can aggregate data elements into larger, more complex structures. For example, arrays and lists can create matrices and graphs, enabling the representation and manipulation of intricate data relationships.

8. Modularity and Reusability

Data structures promote modularity and reusability in software development. Well-designed data structures can be used as building blocks for various applications, reducing code duplication and improving maintainability.

9. Complex Problem Solving

Data structures play a crucial role in solving complex computational problems. Algorithms often rely on specific data structures tailored to the problem’s requirements. For instance, graph algorithms use data structures like adjacency matrices or linked lists to represent and traverse graphs efficiently.

10. Resource Efficiency

Selecting the right data structure for a particular task can impact the efficiency of an application. Regards to this, Data structures helps in minimizing resource usage, such as time and memory, leading to faster and more responsive software.

11. Scalability

Scalability is a critical consideration in modern software development. Data structures that efficiently handle large datasets and adapt to changing workloads are essential for building scalable applications and systems.

12. Algorithm Optimization

Algorithms that use appropriate data structures can be optimized for speed and efficiency. For example, by choosing a hash table data structure, you can achieve constant-time average-case lookup operations, improving the performance of algorithms relying on data retrieval.

13. Code Readability and Maintainability

Well-defined data structures contribute to code readability and maintainability. They provide clear abstractions for data manipulation, making it easier for developers to understand, maintain, and extend code over time.

14. Cross-Disciplinary Applications

Data structures are not limited to computer science; they find applications in various fields, such as biology, engineering, and finance. Efficient data organization and manipulation are essential in scientific research and data analysis.

Other benefits:

  • It can store variables of various data types.
  • It allows the creation of objects that feature various types of attributes.
  • It allows reusing the data layout across programs.
  • It can implement other data structures like stacks, linked lists, trees, graphs, queues, etc.

Why study data structures & algorithms?

  • They help to solve complex real-time problems.
  • They improve analytical and problem-solving skills.
  • They help you to crack technical interviews.
  • Topics in data structure can efficiently manipulate the data.

Studying relevant DSA topics increases job opportunities and earning potential. Therefore, they guarantee career advancement.

Data Structures Projects Ideas

1. obscure binary search trees.

Items, such as names, numbers, etc. can be stored in memory in a sorted order called binary search trees or BSTs. And some of these data structures can automatically balance their height when arbitrary items are inserted or deleted. Therefore, they are known as self-balancing BSTs. Further, there can be different implementations of this type, like the BTrees, AVL trees, and red-black trees. But there are many other lesser-known executions that you can learn about. Some examples include AA trees, 2-3 trees, splay trees, scapegoat trees, and treaps. 

You can base your project on these alternatives and explore how they can outperform other widely-used BSTs in different scenarios. For instance, splay trees can prove faster than red-black trees under the conditions of serious temporal locality. 

Also, check out our business analytics course  to widen your horizon.

2. BSTs following the memoization algorithm

Memoization related to dynamic programming. In reduction-memoizing BSTs, each node can memoize a function of its subtrees. Consider the example of a BST of persons ordered by their ages. Now, let the child nodes store the maximum income of each individual. With this structure, you can answer queries like, “What is the maximum income of people aged between 18.3 and 25.3?” It can also handle updates in logarithmic time. 

Moreover, such data structures are easy to accomplish in C language. You can also attempt to bind it with Ruby and a convenient API. Go for an interface that allows you to specify ‘lambda’ as your ordering function and your subtree memoizing function. All in all, you can expect reduction-memoizing BSTs to be self-balancing BSTs with a dash of additional book-keeping. 

Dynamic coding will need cognitive memorisation for its implementation. Each vertex in a reducing BST can memorise its sub–trees’ functionality. For example, a BST of persons is categorised by their age.

This DSA topics based project idea allows the kid node to store every individual’s maximum salary. This framework can be used to answer the questions like “what’s the income limit of persons aged 25 to 30?”

Checkout:  Types of Binary Tree

Explore our Popular Data Science Courses

3. heap insertion time.

When looking for data structure projects , you want to encounter distinct problems being solved with creative approaches. One such unique research question concerns the average case insertion time for binary heap data structures. According to some online sources, it is constant time, while others imply that it is log(n) time. 

But Bollobas and Simon give a numerically-backed answer in their paper entitled, “Repeated random insertion into a priority queue.” First, they assume a scenario where you want to insert n elements into an empty heap. There can be ‘n!’ possible orders for the same. Then, they adopt the average cost approach to prove that the insertion time is bound by a constant of 1.7645.

When looking for Data Structures tasks in this project idea, you will face challenges that are addressed using novel methods. One of the interesting research subjects is the mean response insertion time for the sequential heap DS.

Inserting ‘n’ components into an empty heap will yield ‘n!’ arrangements which you can use in suitable DSA projects in C++ . Subsequently, you can implement the estimated cost approach to specify that the inserting period is limited by a fixed constant.

Our learners also read : Excel online course free !

4. Optimal treaps with priority-changing parameters

Treaps are a combination of BSTs and heaps. These randomized data structures involve assigning specific priorities to the nodes. You can go for a project that optimizes a set of parameters under different settings. For instance, you can set higher preferences for nodes that are accessed more frequently than others. Here, each access will set off a two-fold process:

  • Choosing a random number
  • Replacing the node’s priority with that number if it is found to be higher than the previous priority

As a result of this modification, the tree will lose its random shape. It is likely that the frequently-accessed nodes would now be near the tree’s root, hence delivering faster searches. So, experiment with this data structure and try to base your argument on evidence. 

Also read : Python online course free !

At the end of the project, you can either make an original discovery or even conclude that changing the priority of the node does not deliver much speed. It will be a relevant and useful exercise, nevertheless.

Constructing a heap involves building an ordered binary tree and letting it fulfill the “heap” property. But if it is done using a single element, it would appear like a line. This is because in the BST, the right child should be greater or equal to its parent, and the left child should be less than its parent. However, for a heap, every parent must either be all larger or all smaller than its children.

The numbers show the data structure’s heap arrangement (organized in max-heap order). The alphabets show the tree portion. Now comes the time to use the unique property of treap data structure in DSA projects in C++ . This treap has only one arrangement irrespective of the order by which the elements were chosen to build the tree.

You can use a random heap weight to make the second key more useful. Hence, now the tree’s structure will completely depend on the randomized weight offered to the heap values. In the file structure mini project topics , we obtain randomized heap priorities by ascertaining that you assign these randomly.

Top Data Science Skills to Learn

upGrad’s Exclusive Data Science Webinar for you –

Transformation & Opportunities in Analytics & Insights

5. Research project on k-d trees

K-dimensional trees or k-d trees organize and represent spatial data. These data structures have several applications, particularly in multi-dimensional key searches like nearest neighbor and range searches. Here is how k-d trees operate:

  • Every leaf node of the binary tree is a k-dimensional point
  • Every non-leaf node splits the hyperplane (which is perpendicular to that dimension) into two half-spaces
  • The left subtree of a particular node represents the points to the left of the hyperplane. Similarly, the right subtree of that node denotes the points in the right half.

You can probe one step further and construct a self-balanced k-d tree where each leaf node would have the same distance from the root. Also, you can test it to find whether such balanced trees would prove optimal for a particular kind of application. 

Also, visit upGrad’s Degree Counselling  page for all undergraduate and postgraduate programs.

Read our popular Data Science Articles

With this, we have covered five interesting ideas that you can study, investigate, and try out. Now, let us look at some more projects on data structures and algorithms . 

Read : Data Scientist Salary in India

6. Knight’s travails

In this project, we will understand two algorithms in action – BFS and DFS. BFS stands for Breadth-First Search and utilizes the Queue data structure to find the shortest path. Whereas, DFS refers to Depth-First Search and traverses Stack data structures. 

For starters, you will need a data structure similar to binary trees. Now, suppose that you have a standard 8 X 8 chessboard, and you want to show the knight’s movements in a game. As you may know, a knight’s basic move in chess is two forward steps and one sidestep. Facing in any direction and given enough turns, it can move from any square on the board to any other square. 

If you want to know the simplest way your knight can move from one square (or node) to another in a two-dimensional setup, you will first have to build a function like the one below.

  • knight_plays([0,0], [1,2]) == [[0,0], [1,2]]
  • knight_plays([0,0], [3,3]) == [[0,0], [1,2], [3,3]]
  • knight_plays([3,3], [0,0]) == [[3,3], [1,2], [0,0]]

 Furthermore, this project would require the following tasks: 

  • Creating a script for a board game and a night
  • Treating all possible moves of the knight as children in the tree structure
  • Ensuring that any move does not go off the board
  • Choosing a search algorithm for finding the shortest path in this case
  • Applying the appropriate search algorithm to find the best possible move from the starting square to the ending square.

7. Fast data structures in non-C systems languages

Programmers usually build programs quickly using high-level languages like Ruby or Python but implement data structures in C/C++. And they create a binding code to connect the elements. However, the C language is believed to be error-prone, which can also cause security issues. Herein lies an exciting project idea. 

You can implement a data structure in a modern low-level language such as Rust or Go, and then bind your code to the high-level language. With this project, you can try something new and also figure out how bindings work. If your effort is successful, you can even inspire others to do a similar exercise in the future and drive better performance-orientation of data structures.  

Also read: Data Science Project Ideas for Beginners

8. Search engine for data structures

The software aims to automate and speed up the choice of data structures for a given API. This project not only demonstrates novel ways of representing different data structures but also optimizes a set of functions to equip inference on them. We have compiled its summary below.

  • The data structure search engine project requires knowledge about data structures and the relationships between different methods.
  • It computes the time taken by each possible composite data structure for all the methods.
  • Finally, it selects the best data structures for a particular case. 

Read: Data Mining Project Ideas

9. Phone directory application using doubly-linked lists

This project can demonstrate the working of contact book applications and also teach you about data structures like arrays, linked lists, stacks, and queues. Typically, phone book management encompasses searching, sorting, and deleting operations. A distinctive feature of the search queries here is that the user sees suggestions from the contact list after entering each character. You can read the source-code of freely available projects and replicate the same to develop your skills. 

This project demonstrates how to address the book programs’ function. It also teaches you about queuing, stacking, linking lists, and arrays. Usually, this project’s directory includes certain actions like categorising, scanning, and removing. Subsequently, the client shows recommendations from the address book after typing each character. This is the web searches’ unique facet. You can inspect the code of extensively used DSA projects in C++ and applications and ultimately duplicate them. This helps you to advance your data science career.

10. Spatial indexing with quadtrees

The quadtree data structure is a special type of tree structure, which can recursively divide a flat 2-D space into four quadrants. Each hierarchical node in this tree structure has either zero or four children. It can be used for various purposes like sparse data storage, image processing, and spatial indexing. 

Spatial indexing is all about the efficient execution of select geometric queries, forming an essential part of geo-spatial application design. For example, ride-sharing applications like Ola and Uber process geo-queries to track the location of cabs and provide updates to users. Facebook’s Nearby Friends feature also has similar functionality. Here, the associated meta-data is stored in the form of tables, and a spatial index is created separately with the object coordinates. The problem objective is to find the nearest point to a given one. 

You can pursue quadtree data structure projects in a wide range of fields, from mapping, urban planning, and transportation planning to disaster management and mitigation. We have provided a brief outline to fuel your problem-solving and analytical skills. 

QuadTrees are techniques for indexing spatial data. The root node signifies the whole area and every internal node signifies an area called a quadrant which is obtained by dividing the area enclosed into half across both axes. These basics are important to understand QuadTrees-related data structures topics.

Objective: Creating a data structure that enables the following operations

  • Insert a location or geometric space
  • Search for the coordinates of a specific location
  • Count the number of locations in the data structure in a particular contiguous area

One of the leading applications of QuadTrees in the data structure is finding the nearest neighbor. For example, you are dealing with several points in a space in one of the data structures topics . Suppose somebody asks you what’s the nearest point to an arbitrary point. You can search in a quadtree to answer this question. If there is no nearest neighbor, you can specify that there is no point in this quadrant to be the nearest neighbor to an arbitrary point. Consequently, you can save time otherwise spent on comparisons.

Spatial indexing with Quadtrees is also used in image compression wherein every node holds the average color of each child. You get a more detailed image if you dive deeper into the tree. This project idea is also used in searching for the nods in a 2D area. For example, you can use quadtrees to find the nearest point to the given coordinates.

Follow these steps to build a quadtree from a two-dimensional area:

  • Divide the existing two-dimensional space into four boxes.
  • Create a child object if a box holds one or more points within.  This object stores the box’s 2D space.
  • Don’t create a child for a box that doesn’t include any points.
  • Repeat these steps for each of the children.
  • You can follow these steps while working on one of the file structure mini project topics .

11. Graph-based projects on data structures

You can take up a project on topological sorting of a graph. For this, you will need prior knowledge of the DFS algorithm. Here is the primary difference between the two approaches:

  • We print a vertex & then recursively call the algorithm for adjacent vertices in DFS.
  • In topological sorting, we recursively first call the algorithm for adjacent vertices. And then, we push the content into a stack for printing. 

Therefore, the topological sort algorithm takes a directed acyclic graph or DAG to return an array of nodes. 

Let us consider the simple example of ordering a pancake recipe. To make pancakes, you need a specific set of ingredients, such as eggs, milk, flour or pancake mix, oil, syrup, etc. This information, along with the quantity and portions, can be easily represented in a graph.

But it is equally important to know the precise order of using these ingredients. This is where you can implement topological ordering. Other examples include making precedence charts for optimizing database queries and schedules for software projects. Here is an overview of the process for your reference:

  • Call the DFS algorithm for the graph data structure to compute the finish times for the vertices
  • Store the vertices in a list with a descending finish time order 
  • Execute the topological sort to return the ordered list 

12. Numerical representations with random access lists

In the representations we have seen in the past, numerical elements are generally held in Binomial Heaps. But these patterns can also be implemented in other data structures. Okasaki has come up with a numerical representation technique using binary random access lists. These lists have many advantages:

  • They enable insertion at and removal from the beginning
  • They allow access and update at a particular index

Know more: The Six Most Commonly Used Data Structures in R

13. Stack-based text editor

Your regular text editor has the functionality of editing and storing text while it is being written or edited. So, there are multiple changes in the cursor position. To achieve high efficiency, we require a fast data structure for insertion and modification. And the ordinary character arrays take time for storing strings. 

You can experiment with other data structures like gap buffers and ropes to solve these issues. Your end objective will be to attain faster concatenation than the usual strings by occupying smaller contiguous memory space. 

This project idea handles text manipulation and offers suitable features to improve the experience. The key functionalities of text editors include deleting, inserting, and viewing text. Other features needed to compare with other text editors are copy/cut and paste, find and replace, sentence highlighting, text formatting, etc.

This project idea’s functioning depends on the data structures you determined to use for your operations. You will face tradeoffs when choosing among the data structures. This is because you must consider the implementation difficulty for the memory and performance tradeoffs. You can use this project idea in different file structure mini project topics to accelerate the text’s insertion and modification.

Data structure skills are foundational in software development, especially for managing vast data sets in today’s digital landscape. Top companies like Adobe, Amazon, and Google seek professionals proficient in data structures and algorithms for lucrative positions. During interviews, recruiters evaluate not only theoretical knowledge but also practical skills. Therefore, practicing data structure project ideas for beginners is essential to kickstart your career.  

If you’re interested in delving into data science, I strongly recommend exploring I IIT-B & upGrad’s Executive PG Programme in Data Science . Tailored for working professionals, this program offers 10+ case studies & projects, practical workshops, mentorship with industry experts, 1-on-1 sessions with mentors, 400+ hours of learning, and job assistance with leading firms. It’s a comprehensive opportunity to advance your skills and excel in the field.  

Profile

Rohit Sharma

Something went wrong

Our Popular Data Science Course

Data Science Course

Data Science Skills to Master

  • Data Analysis Courses
  • Inferential Statistics Courses
  • Hypothesis Testing Courses
  • Logistic Regression Courses
  • Linear Regression Courses
  • Linear Algebra for Analysis Courses

Our Trending Data Science Courses

  • Data Science for Managers from IIM Kozhikode - Duration 8 Months
  • Executive PG Program in Data Science from IIIT-B - Duration 12 Months
  • Master of Science in Data Science from LJMU - Duration 18 Months
  • Executive Post Graduate Program in Data Science and Machine LEarning - Duration 12 Months
  • Master of Science in Data Science from University of Arizona - Duration 24 Months

Frequently Asked Questions (FAQs)

There are certain types of containers that are used to store data. These containers are nothing but data structures. These containers have different properties associated with them, which are used to store, organize, and manipulate the data stored in them. There can be two types of data structures based on how they allocate the data. Linear data structures like arrays and linked lists and dynamic data structures like trees and graphs.

In linear data structures, each element is linearly connected to each other having reference to the next and previous elements whereas in non-linear data structures, data is connected in a non-linear or hierarchical manner. Implementing a linear data structure is much easier than a non-linear data structure since it involves only a single level. If we see memory-wise then the non-linear data structures are better than their counterpart since they consume memory wisely and do not waste it.

You can see applications based on data structures everywhere around you. The google maps application is based on graphs, call centre systems use queues, file explorer applications are based on trees, and even the text editor that you use every day is based upon stack data structure and this list can go on. Not just applications, but many popular algorithms are also based on these data structures. One such example is that of the decision trees. Google search uses trees to implement its amazing auto-complete feature in its search bar.

Related Programs View All

data structures case study topics

View Program

data structures case study topics

Executive PG Program

Complimentary Python Bootcamp

data structures case study topics

Master's Degree

Live Case Studies and Projects

data structures case study topics

8+ Case Studies & Assignments

data structures case study topics

Certification

Live Sessions by Industry Experts

ChatGPT Powered Interview Prep

data structures case study topics

Top US University

data structures case study topics

120+ years Rich Legacy

Based in the Silicon Valley

data structures case study topics

Case based pedagogy

High Impact Online Learning

data structures case study topics

Mentorship & Career Assistance

AACSB accredited

Placement Assistance

Earn upto 8LPA

data structures case study topics

Interview Opportunity

8-8.5 Months

Exclusive Job Portal

data structures case study topics

Learn Generative AI Developement

Explore Free Courses

Study Abroad Free Course

Learn more about the education system, top universities, entrance tests, course information, and employment opportunities in Canada through this course.

Marketing

Advance your career in the field of marketing with Industry relevant free courses

Data Science & Machine Learning

Build your foundation in one of the hottest industry of the 21st century

Management

Master industry-relevant skills that are required to become a leader and drive organizational success

Technology

Build essential technical skills to move forward in your career in these evolving times

Career Planning

Get insights from industry leaders and career counselors and learn how to stay ahead in your career

Law

Kickstart your career in law by building a solid foundation with these relevant free courses.

Chat GPT + Gen AI

Stay ahead of the curve and upskill yourself on Generative AI and ChatGPT

Soft Skills

Build your confidence by learning essential soft skills to help you become an Industry ready professional.

Study Abroad Free Course

Learn more about the education system, top universities, entrance tests, course information, and employment opportunities in USA through this course.

Suggested Blogs

Top 13 Highest Paying Data Science Jobs in India [A Complete Report]

by Rohit Sharma

12 Apr 2024

Most Common PySpark Interview Questions & Answers [For Freshers & Experienced]

05 Mar 2024

Data Science for Beginners: A Comprehensive Guide

by Harish K

28 Feb 2024

6 Best Data Science Institutes in 2024 (Detailed Guide)

by Rohan Vats

27 Feb 2024

Data Mining Architecture: Components, Types & Techniques

19 Feb 2024

Sorting in Data Structure: Categories & Types [With Examples]

  • Trending Now
  • Foundational Courses
  • Data Science
  • Practice Problem
  • Machine Learning
  • System Design
  • DevOps Tutorial

Data Structures Tutorial

  • Introduction to Data Structures
  • Data Structure Types, Classifications and Applications

Overview of Data Structures

  • Introduction to Linear Data Structures
  • Introduction to Hierarchical Data Structure
  • Overview of Graph, Trie, Segment Tree and Suffix Tree Data Structures

Different Types of Data Structures

  • Array Data Structure
  • String in Data Structure
  • Linked List Data Structure
  • Stack Data Structure
  • Queue Data Structure
  • Introduction to Tree - Data Structure and Algorithm Tutorials
  • Heap Data Structure
  • Hashing in Data Structure
  • Graph Data Structure And Algorithms
  • Matrix Data Structure
  • Advanced Data Structures
  • Data Structure Alignment : How data is arranged and accessed in Computer Memory?
  • Static Data Structure vs Dynamic Data Structure
  • Static and Dynamic data structures in Java with Examples
  • Common operations on various Data Structures
  • Real-life Applications of Data Structures and Algorithms (DSA)

Different Types of Advanced Data Structures

Data structures  are essential components that help organize and store data efficiently in computer memory. They provide a way to manage and manipulate data effectively, enabling faster access, insertion, and deletion operations.

Common data structures include  arrays, linked lists, stacks, queues, trees, and graphs  , each serving specific purposes based on the requirements of the problem. Understanding data structures is fundamental for designing efficient algorithms and optimizing software performance.

data structures case study topics

Data Structure

Table of Content

What is a Data Structure?

Why are data structures important, classification of data structures, types of data structures, applications of data structures.

  • Learn Basics of Data Structure
  • Most Popular Data Structures
  • Advanced Data Structure

A data structure is a way of organizing and storing data in a computer so that it can be accessed and used efficiently. It defines the relationship between the data and the operations that can be performed on the data

Data structures are essential for the following reasons:

  • Efficient Data Management: They enable efficient storage and retrieval of data, reducing processing time and improving performance.
  • Data Organization: They organize data in a logical manner, making it easier to understand and access.
  • Data Abstraction: They hide the implementation details of data storage, allowing programmers to focus on the logical aspects of data manipulation.
  • Reusability: Common data structures can be reused in multiple applications, saving time and effort in development.
  • Algorithm Optimization: The choice of the appropriate data structure can significantly impact the efficiency of algorithms that operate on the data.

Data structures can be classified into two main categories:

  • Linear Data Structures: These structures store data in a sequential order this allowing for easy insertion and deletion operations. Examples include arrays, linked lists, and queues.
  • Non-Linear Data Structures: These structures store data in a hierarchical or interconnected manner this allowing for more complex relationships between data elements. Examples include trees, graphs, and hash tables.

Basically, data structures are divided into two categories:

Linear Data Structures:

  • Array: A collection of elements of the same type stored in contiguous memory locations.
  • Linked List: A collection of elements linked together by pointers, allowing for dynamic insertion and deletion.
  • Queue: A First-In-First-Out (FIFO) structure where elements are added at the end and removed from the beginning.
  • Stack: A Last-In-First-Out (LIFO) structure where elements are added and removed from the top.

Non-Linear Data Structures:

  • Tree: A hierarchical structure where each node can have multiple child nodes.
  • Graph: A collection of nodes connected by edges, representing relationships between data elements.
  • Hash Table: A data structure that uses a hash function to map keys to values, allowing for fast lookup and insertion.

Data structures are widely used in various applications, including:

  • Database Management Systems: To store and manage large amounts of structured data.
  • Operating Systems: To manage memory, processes, and files.
  • Compiler Design: To represent source code and intermediate code.
  • Artificial Intelligence: To represent knowledge and perform reasoning.
  • Graphics and Multimedia: To store and process images, videos, and audio data.

Learn Basics of Data Structure:

  • Overview of Data Structures | Set 3 (Graph, Trie, Segment Tree and Suffix Tree)
  • Abstract Data Types

Most Popular Data Structures :

Below are some most popular Data Structure:

Array is a linear data structure that stores a collection of elements of the same data type. Elements are allocated contiguous memory, allowing for constant-time access. Each element has a unique index number.

Important articles on Array:

  • Search, insert and delete in an unsorted array
  • Search, insert and delete in a sorted array
  • Write a program to reverse an array
  • Leaders in an array
  • Given an array A[] and a number x, check for pair in A[] with sum as x
  • Majority Element
  • Find the Number Occurring Odd Number of Times
  • Largest Sum Contiguous Subarray
  • Find the Missing Number
  • Search an element in a sorted and pivoted array
  • Merge an array of size n into another array of size m+n
  • Median of two sorted arrays
  • Program for array rotation
  • Reversal algorithm for array rotation
  • Block swap algorithm for array rotation
  • Maximum sum such that no two elements are adjacent
  • Sort elements by frequency | Set 1
  • Count Inversions in an array

Related articles on Array:

  • All Articles on Array
  • Coding Practice on Array
  • Quiz on Array
  • Recent Articles on Array

A matrix is a two-dimensional array of elements, arranged in rows and columns. It is represented as a rectangular grid, with each element at the intersection of a row and column.

Important articles on Matrix:

  • Search in a row wise and column wise sorted matrix
  • Print a given matrix in spiral form
  • A Boolean Matrix Question
  • Print unique rows in a given boolean matrix
  • Maximum size square sub-matrix with all 1s
  • Inplace M x N size matrix transpose | Updated
  • Dynamic Programming | Set 27 (Maximum sum rectangle in a 2D matrix)
  • Strassen’s Matrix Multiplication
  • Create a matrix with alternating rectangles of O and X
  • Print all elements in sorted order from row and column wise sorted matrix
  • Given an n x n square matrix, find sum of all sub-squares of size k x k
  • Count number of islands where every island is row-wise and column-wise separated
  • Find a common element in all rows of a given row-wise sorted matrix

Related articles on Matrix:

  • All Articles on Matrix
  • Coding Practice on Matrix
  • Recent Articles on Matrix.

3. Linked List:

A linear data structure where elements are stored in nodes linked together by pointers. Each node contains the data and a pointer to the next node in the list. Linked lists are efficient for inserting and deleting elements, but they can be slower for accessing elements than arrays.

Types of Linked List:

a) Singly Linked List: Each node points to the next node in the list.

Important articles on Singly Linked Lis:

  • Introduction to Linked List
  • Linked List vs Array
  • Linked List Insertion
  • Linked List Deletion (Deleting a given key)
  • Linked List Deletion (Deleting a key at given position)
  • A Programmer’s approach of looking at Array vs. Linked List
  • Find Length of a Linked List (Iterative and Recursive)
  • How to write C functions that modify head pointer of a Linked List?
  • Swap nodes in a linked list without swapping data
  • Reverse a linked list
  • Merge two sorted linked lists
  • Merge Sort for Linked Lists
  • Reverse a Linked List in groups of given size
  • Detect and Remove Loop in a Linked List
  • Add two numbers represented by linked lists | Set 1
  • Rotate a Linked List
  • Generic Linked List in C

b) Circular Linked List: The last node points back to the first node, forming a circular loop.

Important articles on Circular Linked List:

  • Circular Linked List Introduction and Applications,
  • Circular Singly Linked List Insertion
  • Circular Linked List Traversal
  • Split a Circular Linked List into two halves
  • Sorted insert for circular linked list

c) Doubly Linked List: Each node points to both the next and previous nodes in the list.

Important articles on Doubly Linked List:

  • Doubly Linked List Introduction and Insertion
  • Delete a node in a Doubly Linked List
  • Reverse a Doubly Linked List
  • The Great Tree-List Recursion Problem.
  • QuickSort on Doubly Linked List
  • Merge Sort for Doubly Linked List

Related articles on Linked List:

  • All Articles of Linked List
  • Coding Practice on Linked List
  • Recent Articles on Linked List

Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out) . LIFO implies that the element that is inserted last, comes out first and FILO implies that the element that is inserted first, comes out last.

Important articles on Stack:

  • Introduction to Stack
  • Infix to Postfix Conversion using Stack
  • Evaluation of Postfix Expression
  • Reverse a String using Stack
  • Implement two stacks in an array
  • Check for balanced parentheses in an expression
  • Next Greater Element
  • Reverse a stack using recursion
  • Sort a stack using recursion
  • The Stock Span Problem
  • Design and Implement Special Stack Data Structure
  • Implement Stack using Queues
  • Design a stack with operations on middle element
  • How to efficiently implement k stacks in a single array?

Related articles on Stack:

  • All Articles on Stack
  • Coding Practice on Stack
  • Recent Articles on Stack

A Queue Data Structure is a fundamental concept in computer science used for storing and managing data in a specific order. It follows the principle of “First in, First out ” ( FIFO ), where the first element added to the queue is the first one to be removed

Important articles on Queue:

  • Queue Introduction and Array Implementation
  • Linked List Implementation of Queue
  • Applications of Queue Data Structure
  • Priority Queue Introduction
  • Deque (Introduction and Applications)
  • Implementation of Deque using circular array
  • Implement Queue using Stacks
  • Find the first circular tour that visits all petrol pumps
  • Maximum of all subarrays of size k
  • An Interesting Method to Generate Binary Numbers from 1 to n
  • How to efficiently implement k Queues in a single array?

Related articles on Queue:

  • All Articles on Queue
  • Coding Practice on Queue
  • Recent Articles on Queue

6. Binary Tree:

Binary Tree is a hierarchical data structure where each node has at most two child nodes, referred to as the left child and the right child. Binary trees are mostly used to represent hierarchical data, such as file systems or family trees.

Important articles on Binary Tree:

  • Binary Tree Introduction
  • Binary Tree Properties
  • Types of Binary Tree
  • Handshaking Lemma and Interesting Tree Properties
  • Enumeration of Binary Tree
  • Applications of tree data structure
  • Tree Traversals
  • BFS vs DFS for Binary Tree
  • Level Order Tree Traversal
  • Diameter of a Binary Tree
  • Inorder Tree Traversal without Recursion
  • Inorder Tree Traversal without recursion and without stack!
  • Threaded Binary Tree
  • Maximum Depth or Height of a Tree
  • If you are given two traversal sequences, can you construct the binary tree?
  • Clone a Binary Tree with Random Pointers
  • Construct Tree from given Inorder and Preorder traversals
  • Maximum width of a binary tree
  • Print nodes at k distance from root
  • Print Ancestors of a given node in Binary Tree
  • Check if a binary tree is subtree of another binary tree
  • Connect nodes at same level

Related articles on Binary Tree:

  • All articles on Binary Tree
  • Coding Practice on Binary Tree
  • Recent Articles on Tree

7. Binary Search Tree:

A Binary Search Tree is a data structure used for storing data in a sorted manner. Each node in a Binary Search Tree has at most two children, a left child and a right child, with the left child containing values less than the parent node and the right child containing values greater than the parent node. This hierarchical structure allows for efficient searching, insertion, and deletion operations on the data stored in the tree.

Important articles on Binary Search Tree:

  • Search and Insert in BST
  • Deletion from BST
  • Minimum value in a Binary Search Tree
  • Inorder predecessor and successor for a given key in BST
  • Check if a binary tree is BST or not
  • Lowest Common Ancestor in a Binary Search Tree.
  • Inorder Successor in Binary Search Tree
  • Find k-th smallest element in BST (Order Statistics in BST)
  • Merge two BSTs with limited extra space
  • Two nodes of a BST are swapped, correct the BST
  • Floor and Ceil from a BST
  • In-place conversion of Sorted DLL to Balanced BST
  • Find a pair with given sum in a Balanced BST
  • Total number of possible Binary Search Trees with n keys
  • Merge Two Balanced Binary Search Trees
  • Binary Tree to Binary Search Tree Conversion

Related articles on Binary Search Tree:

  • All Articles on Binary Search Tree
  • Coding Practice on Binary Search Tree
  • Recent Articles on BST

A Heap is a complete binary tree data structure that satisfies the heap property: for every node, the value of its children is less than or equal to its own value. Heaps are usually used to implement priority queues , where the smallest (or largest) element is always at the root of the tree.

Important articles on Heap:

  • Binary Heap
  • Why is Binary Heap Preferred over BST for Priority Queue?
  • K’th Largest Element in an array
  • Sort an almost sorted array
  • Binomial Heap
  • Fibonacci Heap
  • Tournament Tree (Winner Tree) and Binary Heap

Related articles on Heap:

  • All Articles on Heap
  • Coding Practice on Heap
  • Recent Articles on Heap

9. Hashing:

Hashing  is a technique that generates a fixed-size output (hash value) from an input of variable size using mathematical formulas called  hash functions . Hashing is used to determine an index or location for storing an item in a data structure, allowing for efficient retrieval and insertion.

Important articles on Hashing:

  • Hashing Introduction
  • Separate Chaining for Collision Handling
  • Open Addressing for Collision Handling
  • Print a Binary Tree in Vertical Order
  • Find whether an array is subset of another array
  • Union and Intersection of two Linked Lists
  • Find a pair with given sum
  • Check if a given array contains duplicate elements within k distance from each other
  • Find Itinerary from a given list of tickets
  • Find number of Employees Under every Employee

Related articles on Hashing:

  • All Articles on Hashing
  • Coding Practice on Hashing
  • Recent Articles on Hashing

Graph is a collection of nodes connected by edges. Graphs are mostly used to represent networks, such as social networks or transportation networks.

Important articles on Graph:

  • Graph and its representations
  • Breadth First Traversal for a Graph
  • Depth First Traversal for a Graph
  • Applications of Depth First Search
  • Applications of Breadth First Traversal
  • Detect Cycle in a Directed Graph
  • Detect Cycle in Graph using DSU
  • Detect cycle in an Undirected Graph using DFS
  • Longest Path in a Directed Acyclic Graph
  • Topological Sorting
  • Check whether a given graph is Bipartite or not
  • Snake and Ladder Problem
  • Minimize Cash Flow among a given set of friends who have borrowed money from each other
  • Boggle (Find all possible words in a board of characters)
  • Assign directions to edges so that the directed graph remains acyclic

Related articles on Graph:

  • All Articles on Graph Data Structure
  • Coding Practice on Graph
  • Recent Articles on Graph

Advanced Data Structure:

Below are some advance Data Structure:

1. Advanced Lists:

Advanced Lists is a data structure that extends the functionality of a standard list. Advanced lists may support additional operations, such as finding the minimum or maximum element in the list, or rotating the list.

Important articles on Advanced Lists:

  • Memory efficient doubly linked list
  • XOR Linked List – A Memory Efficient Doubly Linked List | Set 1
  • XOR Linked List – A Memory Efficient Doubly Linked List | Set 2
  • Skip List | Set 1 (Introduction)
  • Self Organizing List | Set 1 (Introduction)
  • Unrolled Linked List | Set 1 (Introduction)

2. Segment Tree:

Segment Tree is a tree data structure that allows for efficient range queries on an array. Each node in the segment tree represents a range of elements in the array, and the value stored in the node is some aggregate value of the elements in that range.

Important articles on Segment Tree:

  • Segment Tree | Set 1 (Sum of given range)
  • Segment Tree | Set 2 (Range Minimum Query)
  • Lazy Propagation in Segment Tree
  • Persistent Segment Tree | Set 1 (Introduction)

Related articles on Segment Tree:

  • All articles on Segment Tree

Trie is a tree-like data structure that is used to store strings. Each node in the trie represents a prefix of a string, and the children of a node represent the different characters that can follow that prefix. Tries are often used for efficient string matching and searching.

Important articles on Trie:

  • Trie | (Insert and Search)
  • Trie | (Delete)
  • Longest prefix matching – A Trie based solution in Java
  • How to Implement Reverse DNS Look Up Cache?
  • How to Implement Forward DNS Look Up Cache?

Related articles on Trie :

  • All Articles on Trie

4. Binary Indexed Tree:

Binary Indexed Tree is a data structure that allows for efficient range queries and updates on an array. Binary indexed trees are often used to compute prefix sums or to solve range query problems.

Important articles on Binary Indexed Tree:

  • Binary Indexed Tree
  • Two Dimensional Binary Indexed Tree or Fenwick Tree
  • Binary Indexed Tree : Range Updates and Point Queries
  • Binary Indexed Tree : Range Update and Range Queries

Related articles on Binary Indexed Tree :

  • All Articles on Binary Indexed Tree

5. Suffix Array and Suffix Tree :

Suffix Array and Suffix Tree is a data structures that are used to efficiently search for patterns within a string. Suffix arrays and suffix trees are mostly used in bioinformatics and text processing applications.

Important articles on Suffix Array and Suffix Tree:

  • Suffix Array Introduction
  • Suffix Array nLogn Algorithm
  • kasai’s Algorithm for Construction of LCP array from Suffix Array
  • Suffix Tree Introduction
  • Ukkonen’s Suffix Tree Construction – Part 1
  • Ukkonen’s Suffix Tree Construction – Part 2
  • Ukkonen’s Suffix Tree Construction – Part 3
  • Ukkonen’s Suffix Tree Construction – Part 4,
  • Ukkonen’s Suffix Tree Construction – Part 5
  • Ukkonen’s Suffix Tree Construction – Part 6
  • Generalized Suffix Tree
  • Build Linear Time Suffix Array using Suffix Tree
  • Substring Check
  • Searching All Patterns
  • Longest Repeated Substring,
  • Longest Common Substring, Longest Palindromic Substring

Related articles on Suffix Array and Suffix Tree:

  • All Articles on Suffix Tree

6. AVL Tree:

AVL tree is a self-balancing binary search tree that maintains a balanced height. AVL trees are mostly used when it is important to have efficient search and insertion operations.

Important articles on AVL Tree:

  • AVL Tree | Set 1 (Insertion)
  • AVL Tree | Set 2 (Deletion)
  • AVL with duplicate keys

7. Splay Tree:

Splay Tree is a self-balancing binary search tree that moves frequently accessed nodes to the root of the tree. Splay trees are mostly used when it is important to have fast access to recently accessed data.

Important articles on Splay Tree:

  • Splay Tree | Set 1 (Search)
  • Splay Tree | Set 2 (Insert)

B Tree is a balanced tree data structure that is used to store data on disk. B trees are mostly used in database systems to efficiently store and retrieve large amounts of data.

Important articles on B Tree:

  • B-Tree | Set 1 (Introduction)
  • B-Tree | Set 2 (Insert)
  • B-Tree | Set 3 (Delete)

9. Red-Black Tree:

Red-Black Tree is a self-balancing binary search tree that maintains a balance between the number of black and red nodes. Red-black trees are mostly used when it is important to have efficient search and insertion operations.

Important articles on Red-Black Tree:

  • Red-Black Tree Introduction
  • Red Black Tree Insertion.
  • Red-Black Tree Deletion
  • Program for Red Black Tree Insertion

Related articles on Red-Black Tree:

  • All Articles on Self-Balancing BSTs

10. K Dimensional Tree:

K Dimensional Tree is a tree data structure that is used to store data in a multidimensional space. K dimensional trees are mostly used for efficient range queries and nearest neighbor searches.

Important articles on K Dimensional Tree:

  • KD Tree (Search and Insert)
  • K D Tree (Find Minimum)
  • K D Tree (Delete)

Others Data Structure:

  • Treap (A Randomized Binary Search Tree)
  • Ternary Search Tree
  • Interval Tree
  • Implement LRU Cache
  • Sort numbers stored on different machines
  • Find the k most frequent words from a file
  • Given a sequence of words, print all anagrams together
  • Decision Trees – Fake (Counterfeit) Coin Puzzle (12 Coin Puzzle)
  • Spaghetti Stack
  • Data Structure for Dictionary and Spell Checker?
  • Cartesian Tree
  • Cartesian Tree Sorting
  • Centroid Decomposition of Tree
  • Gomory-Hu Tree
  • Recent Articles on Advanced Data Structures.
  • Commonly Asked Data Structure Interview Questions | Set 1
  • A data structure for n elements and O(1) operations
  • Expression Tree

Please Login to comment...

Related articles.

advertisewithusBannerImg

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

  • Online Degree Explore Bachelor’s & Master’s degrees
  • MasterTrack™ Earn credit towards a Master’s degree
  • University Certificates Advance your career with graduate-level learning
  • Top Courses
  • Join for Free

University of California San Diego

Data Structures

This course is part of Data Structures and Algorithms Specialization

Taught in English

Some content may not be translated

Neil Rhodes

Instructors: Neil Rhodes +4 more

Instructors

Instructor ratings

We asked all learners to give feedback on our instructors based on the quality of their teaching style.

Michael Levin

Financial aid available

271,756 already enrolled

Coursera Plus

(5,357 reviews)

Recommended experience

Intermediate level

Basic knowledge of at least one programming language: C++, Java, Python, C, C#, Javascript, Haskell, Kotlin, Ruby, Rust, Scala.

Skills you'll gain

  • Priority Queue
  • Binary Search Tree
  • Stack (Abstract Data Type)

Details to know

data structures case study topics

Add to your LinkedIn profile

See how employees at top companies are mastering in-demand skills

Placeholder

Build your subject-matter expertise

  • Learn new concepts from industry experts
  • Gain a foundational understanding of a subject or tool
  • Develop job-relevant skills with hands-on projects
  • Earn a shareable career certificate

Placeholder

Earn a career certificate

Add this credential to your LinkedIn profile, resume, or CV

Share it on social media and in your performance review

Placeholder

There are 6 modules in this course

A good algorithm usually comes together with a set of good data structures that allow the algorithm to manipulate the data efficiently. In this online course, we consider the common data structures that are used in various computational problems. You will learn how these data structures are implemented in different programming languages and will practice implementing them in our programming assignments. This will help you to understand what is going on inside a particular built-in implementation of a data structure and what to expect from it. You will also learn typical use cases for these data structures.

A few examples of questions that we are going to cover in this class are the following: 1. What is a good strategy of resizing a dynamic array? 2. How priority queues are implemented in C++, Java, and Python? 3. How to implement a hash table so that the amortized running time of all operations is O(1) on average? 4. What are good strategies to keep a binary tree balanced? You will also learn how services like Dropbox manage to upload some large files instantly and to save a lot of storage space!

Basic Data Structures

In this module, you will learn about the basic data structures used throughout the rest of this course. We start this module by looking in detail at the fundamental building blocks: arrays and linked lists. From there, we build up two important data structures: stacks and queues. Next, we look at trees: examples of how they’re used in Computer Science, how they’re implemented, and the various ways they can be traversed. Once you’ve completed this module, you will be able to implement any of these data structures, as well as have a solid understanding of the costs of the operations, as well as the tradeoffs involved in using each data structure.

What's included

7 videos 7 readings 1 quiz 1 programming assignment

7 videos • Total 60 minutes

  • Arrays • 7 minutes • Preview module
  • Singly-Linked Lists • 9 minutes
  • Doubly-Linked Lists • 4 minutes
  • Stacks • 10 minutes
  • Queues • 7 minutes
  • Trees • 11 minutes
  • Tree Traversal • 10 minutes

7 readings • Total 70 minutes

  • Welcome • 10 minutes
  • Slides and External References • 10 minutes
  • Available Programming Languages • 10 minutes
  • FAQ on Programming Assignments • 10 minutes
  • Acknowledgements • 10 minutes

1 quiz • Total 30 minutes

  • Basic Data Structures • 30 minutes

1 programming assignment • Total 120 minutes

  • Programming Assignment 1: Basic Data Structures • 120 minutes

Dynamic Arrays and Amortized Analysis

In this module, we discuss Dynamic Arrays: a way of using arrays when it is unknown ahead-of-time how many elements will be needed. Here, we also discuss amortized analysis: a method of determining the amortized cost of an operation over a sequence of operations. Amortized analysis is very often used to analyse performance of algorithms when the straightforward analysis produces unsatisfactory results, but amortized analysis helps to show that the algorithm is actually efficient. It is used both for Dynamic Arrays analysis and will also be used in the end of this course to analyze Splay trees.

5 videos 1 reading 1 quiz

5 videos • Total 30 minutes

  • Dynamic Arrays • 8 minutes • Preview module
  • Amortized Analysis: Aggregate Method • 5 minutes
  • Amortized Analysis: Banker's Method • 6 minutes
  • Amortized Analysis: Physicist's Method • 7 minutes
  • Amortized Analysis: Summary • 2 minutes

1 reading • Total 10 minutes

  • Dynamic Arrays and Amortized Analysis • 30 minutes

Priority Queues and Disjoint Sets

We start this module by considering priority queues which are used to efficiently schedule jobs, either in the context of a computer operating system or in real life, to sort huge files, which is the most important building block for any Big Data processing algorithm, and to efficiently compute shortest paths in graphs, which is a topic we will cover in our next course. For this reason, priority queues have built-in implementations in many programming languages, including C++, Java, and Python. We will see that these implementations are based on a beautiful idea of storing a complete binary tree in an array that allows to implement all priority queue methods in just few lines of code. We will then switch to disjoint sets data structure that is used, for example, in dynamic graph connectivity and image processing. We will see again how simple and natural ideas lead to an implementation that is both easy to code and very efficient. By completing this module, you will be able to implement both these data structures efficiently from scratch.

15 videos 6 readings 3 quizzes 1 programming assignment 1 plugin

15 videos • Total 129 minutes

  • Introduction • 6 minutes • Preview module
  • Naive Implementations of Priority Queues • 5 minutes
  • Binary Trees • 1 minute
  • Basic Operations • 12 minutes
  • Complete Binary Trees • 9 minutes
  • Pseudocode • 8 minutes
  • Heap Sort • 10 minutes
  • Building a Heap • 10 minutes
  • Final Remarks • 4 minutes
  • Overview • 7 minutes
  • Naive Implementations • 10 minutes
  • Trees for Disjoint Sets • 7 minutes
  • Union by Rank • 9 minutes
  • Path Compression • 6 minutes
  • Analysis (Optional) • 18 minutes

6 readings • Total 60 minutes

  • Slides • 10 minutes
  • Tree Height Remark • 10 minutes

3 quizzes • Total 72 minutes

  • Priority Queues and Disjoint Sets • 30 minutes
  • Priority Queues: Quiz • 12 minutes
  • Quiz: Disjoint Sets • 30 minutes
  • Programming Assignment 2: Priority Queues and Disjoint Sets • 120 minutes

1 plugin • Total 10 minutes

  • Survey • 10 minutes

Hash Tables

In this module you will learn about very powerful and widely used technique called hashing. Its applications include implementation of programming languages, file systems, pattern search, distributed key-value storage and many more. You will learn how to implement data structures to store and modify sets of objects and mappings from one type of objects to another one. You will see that naive implementations either consume huge amount of memory or are slow, and then you will learn to implement hash tables that use linear memory and work in O(1) on average! In the end, you will learn how hash functions are used in modern disrtibuted systems and how they are used to optimize storage of services like Dropbox, Google Drive and Yandex Disk!

20 videos 4 readings 2 quizzes 1 programming assignment

20 videos • Total 148 minutes

  • Applications of Hashing • 3 minutes • Preview module
  • Analysing Service Access Logs • 7 minutes
  • Direct Addressing • 7 minutes
  • Hash Functions • 3 minutes
  • Chaining • 7 minutes
  • Chaining Implementation and Analysis • 6 minutes
  • Hash Tables • 6 minutes
  • Phone Book Data Structure • 9 minutes
  • Universal Family • 10 minutes
  • Hashing Phone Numbers • 9 minutes
  • Hashing Names • 6 minutes
  • Analysis of Polynomial Hashing • 8 minutes
  • Find Substring in Text • 6 minutes
  • Rabin-Karp's Algorithm • 8 minutes
  • Recurrence for Substring Hashes • 12 minutes
  • Improving Running Time • 8 minutes
  • Julia's Diary • 6 minutes
  • Julia's Bank • 5 minutes
  • Blockchain • 5 minutes
  • Merkle Tree • 7 minutes

4 readings • Total 40 minutes

2 quizzes • total 60 minutes.

  • Hashing • 30 minutes
  • Hash Tables and Hash Functions • 30 minutes
  • Programming Assignment 3: Hash Tables • 120 minutes

Binary Search Trees

In this module we study binary search trees, which are a data structure for doing searches on dynamically changing ordered sets. You will learn about many of the difficulties in accomplishing this task and the ways in which we can overcome them. In order to do this you will need to learn the basic structure of binary search trees, how to insert and delete without destroying this structure, and how to ensure that the tree remains balanced.

7 videos 2 readings 1 quiz

7 videos • Total 54 minutes

  • Introduction • 7 minutes • Preview module
  • Search Trees • 5 minutes
  • Basic Operations • 10 minutes
  • Balance • 5 minutes
  • AVL Trees • 5 minutes
  • AVL Tree Implementation • 9 minutes
  • Split and Merge • 9 minutes

2 readings • Total 20 minutes

1 quiz • total 20 minutes.

  • Binary Search Trees • 20 minutes

Binary Search Trees 2

In this module we continue studying binary search trees. We study a few non-trivial applications. We then study the new kind of balanced search trees - Splay Trees. They adapt to the queries dynamically and are optimal in many ways.

4 videos 2 readings 1 quiz 1 programming assignment

4 videos • Total 36 minutes

  • Applications • 10 minutes • Preview module
  • Splay Trees: Introduction • 6 minutes
  • Splay Trees: Implementation • 7 minutes
  • (Optional) Splay Trees: Analysis • 10 minutes
  • Splay Trees • 30 minutes

1 programming assignment • Total 180 minutes

  • Programming Assignment 4: Binary Search Trees • 180 minutes

data structures case study topics

UC San Diego is an academic powerhouse and economic engine, recognized as one of the top 10 public universities by U.S. News and World Report. Innovation is central to who we are and what we do. Here, students learn that knowledge isn't just acquired in the classroom—life is their laboratory.

Recommended if you're interested in Algorithms

data structures case study topics

Coursera Project Network

Crea formularios con React Hooks y MUI

Guided Project

data structures case study topics

Stanford University

Divide and Conquer, Sorting and Searching, and Randomized Algorithms

data structures case study topics

Princeton University

Algorithms, Part I

Why people choose coursera for their career.

data structures case study topics

Learner reviews

Showing 3 of 5357

5,357 reviews

Reviewed on May 15, 2020

In depth mathematical analysis and implementation of important Data Structures. This is a very good course for programmers looking to solve computational problems with first principles.

Reviewed on Nov 23, 2019

The lectures and the reading material were great. The assignments are challenging and require thought before attempting. The forums were really useful when I got stuck with the assignments

Reviewed on Sep 27, 2020

Overall, it's good. But some chapters like the binary search tree and hash table, the instructions are now very heuristic. I can only understand the content after reading the textbook.

New to Algorithms? Start here.

Placeholder

Open new doors with Coursera Plus

Unlimited access to 7,000+ world-class courses, hands-on projects, and job-ready certificate programs - all included in your subscription

Advance your career with an online degree

Earn a degree from world-class universities - 100% online

Join over 3,400 global companies that choose Coursera for Business

Upskill your employees to excel in the digital economy

Frequently asked questions

When will i have access to the lectures and assignments.

Access to lectures and assignments depends on your type of enrollment. If you take a course in audit mode, you will be able to see most course materials for free. To access graded assignments and to earn a Certificate, you will need to purchase the Certificate experience, during or after your audit. If you don't see the audit option:

The course may not offer an audit option. You can try a Free Trial instead, or apply for Financial Aid.

The course may offer 'Full Course, No Certificate' instead. This option lets you see all course materials, submit required assessments, and get a final grade. This also means that you will not be able to purchase a Certificate experience.

What will I get if I subscribe to this Specialization?

When you enroll in the course, you get access to all of the courses in the Specialization, and you earn a certificate when you complete the work. Your electronic Certificate will be added to your Accomplishments page - from there, you can print your Certificate or add it to your LinkedIn profile. If you only want to read and view the course content, you can audit the course for free.

What is the refund policy?

If you subscribed, you get a 7-day free trial during which you can cancel at no penalty. After that, we don’t give refunds, but you can cancel your subscription at any time. See our full refund policy Opens in a new tab .

Is financial aid available?

Yes. In select learning programs, you can apply for financial aid or a scholarship if you can’t afford the enrollment fee. If fin aid or scholarship is available for your learning program selection, you’ll find a link to apply on the description page.

More questions

DEV Community

DEV Community

Iulia Groza

Posted on Sep 3, 2020 • Updated on Feb 21

Complete Introduction to the 30 Most Essential Data Structures & Algorithms

Data Structures & Algorithms (DSA) is often considered to be an intimidating topic - a common misbelief. Forming the foundation of the most innovative concepts in tech, they are essential in both jobs/internships applicants' and experienced programmers' journey. Mastering DSA implies that you are able to use your computational and algorithmic thinking in order to solve never-before-seen problems and contribute to any tech company's value (including your own!). By understanding them, you can improve the maintainability, extensibility and efficiency of your code.

These being said, I've decided to centralize all the DSA threads that I have been posting on Twitter during my #100DaysOfCode challenge. This article is aiming to make DSA not look as intimidating as it is believed to be. It includes the 15 most useful data structures and the 15 most important algorithms that can help you ace your interviews and improve your competitive programming skills. Each chapter includes useful links with additional information and practice problems. DS topics are accompanied by a graphic representation and key information. Every algorithm is implemented into a continuously updating Github repo . At the time of writing, it contains the pseudocode, C++, Python and Java (still in progress) implementations of each mentioned algorithm (and not only). This repository is expanding thanks to other talented and passionate developers that are contributing to it by adding new algorithms and new programming languages implementations.

I. Data Structures

  • Linked Lists
  • Maps & Hash Tables
  • Binary Trees & Binary Search Trees
  • Self-balancing Trees (AVL Trees, Red-Black Trees, Splay Trees)
  • Segment Trees
  • Fenwick Trees
  • Disjoint Set Union
  • Minimum Spanning Trees

II. Algorithms

  • Divide and Conquer
  • Sorting Algorithms (Bubble Sort, Counting Sort, Quick Sort, Merge Sort, Radix Sort)
  • Searching Algorithms (Linear Search, Binary Search)
  • Sieve of Eratosthenes
  • Knuth-Morris-Pratt Algorithm
  • Greedy I (Maximum number of non-overlapping intervals on an axis)
  • Greedy II (Fractional Knapsack Problem)
  • Dynamic Programming I (0–1 Knapsack Problem)
  • Dynamic Programming II (Longest Common Subsequence)
  • Dynamic Programming III (Longest Increasing Subsequence)
  • Convex Hull
  • Graph Traversals (Breadth-First Search, Depth-First Search)
  • Floyd-Warshall / Roy-Floyd Algorithm
  • Dijkstra's Algorithm & Bellman-Ford Algorithm
  • Topological Sorting

Arrays

Arrays are the simplest and most common data structures. They are characterised by the facile access of elements by index (position).

What are they used for?

Imagine having a theater chair row. Each chair has assigned a position (from left to right), therefore every spectator will have assigned the number from the chair (s)he will be sitting on. This is an array. Expand the problem to the whole theater (rows and columns of chairs) and you will have a 2D array (matrix)!

  • elements' values are placed in order and accessed by their index from 0 to the length of the array-1;
  • an array is a continuous block of memory;
  • they are usually made of elements of the same type (it depends on the programming language);
  • access and addition of elements are fast; search and deletion are not done in O(1).

Useful Links

  • GeeksforGeeks: Introduction to Arrays
  • LeetCode Problem Set
  • Top 50 Array Coding Problems for Interviews

2. Linked Lists

Linked Lists 1

Linked lists are linear data structures, just like arrays. The main difference between linked lists and arrays is that elements of a linked list are not stored at contiguous memory locations. It is composed of nodes - entities that store the current element's value and an address reference to the next element. That way, elements are linked by pointers.

 One relevant application of linked lists is the implementation of the previous and the next page of a browser. A double linked list is the perfect data structure to store the pages displayed by a user's search.

  • they come in three types: singly, doubly and circular;
  • elements are NOT stored in a contiguous block of memory;
  • perfect for an excellent memory management (using pointers implies dynamic memory usage);
  • insertion and deletion are fast; accessing and searching elements are done in linear time.
  • Visualizing Linked Lists
  • Top 50 Problems on Linked List Data Structure asked in SDE Interviews

Stacks

A stack is an abstract data type that formalizes the concept of restricted access collection. The restriction follows the rule LIFO (Last In, First Out). Therefore, the last element added in the stack is the first element you remove from it. Stacks can be implemented using arrays or linked lists.

The most common real-life example uses plates placed one over another in the canteen. The plate which is at the top is the first to be removed. The plate placed at the bottommost is the one that remains in the stack for the longest period of time. One situation when stacks are the most useful is when you need to obtain the reverse order of given elements. Just push them all in a stack and then pop them. Another interesting application is the Valid Parentheses Problem. Given a string of parantheses, you can check that they are matched using a stack.

  • you can only access the last element at one time (the one at the top);
  • one disadvantage is that once you pop elements from the top in order to access other elements, their values will be lost from the stack's memory;
  • access of other elements is done in linear time; any other operation is in O(1).
  • CS Academy: Stack Introduction
  • CS Academy: Stack Application - Soldiers Row

Queues 1

A queue is another data type from the restricted access collection, just like the previously discussed stack. The main difference is that the queue is organised after the FIFO (First In, First Out) model: the first inserted element in the queue is the first element to be removed. Queues can be implemented using a fixed length array, a circular array or a linked list.

 The best use of this abstract data type (ADT) is, of course, the simulation of a real life queue. For example, in a call center application, a queue is used for saving the clients that are waiting to receive help from the consultant - these clients should get help in the order they called.  One special and very important type of queue is the priority queue. The elements are introduced in the queue based on a "priority" associated with them: the element with the highest priority is the first introduced in the queue. This ADT is essential in many Graph Algorithms (Dijkstra's Algorithm, BFS, Prim's Algorithm, Huffman Coding - more about them below). It is implemented using a heap.  Another special type of queue is the deque ( pun alert it's pronounced "deck"). Elements can be inserted/removed from both endings of the queue.

  • we can directly access only the "oldest" element introduced;
  • searching elements will remove all the accessed elements from the queue's memory;
  • popping/pushing elements or getting the front of the queue is done in constant time. Searching is linear.
  • Visualizing Queues

5. Maps & Hash Tables

Maps

Maps (dictionaries) are abstract data types that contain a collection of keys and a collection of values. Each key has a value associated with it.  A hash table is a particular type of map. It uses a hash function to generate a hash code, into an array of buckets or slots: the key is hashed and the resulting hash indicates where the value is stored.  The most common hash function (among many) is the modulo constant function. e. g. if the constant is 6, the value of the key x is x%6 . Ideally, a hash function will assign each key to a unique bucket, but most of their designs employ an imperfect function, which might conduct to collision between keys with the same generated value. Such collisions are always accomodated in some way.

 The most known application of maps is a language dictionary. Each word from a language has assigned its definition to it. It is implemented using an ordered map (its keys are alphabetically ordered).  Contacts is also a map. Each name has a phone number assigned to it.  Another useful application is normalization of values. Let's say we want to assign to each minute of a day (24 hours = 1440 minutes) an index from 0 to 1439. The hash function will be h(x) = x.hour*60+x.minute .

  • keys are unique (no duplicates);
  • collision resistance: it should be hard to find two different inputs with the same key;
  • pre-image resistance: given a value H, it should be hard to find a key x, such that h(x)=H ;
  • second pre-image resistance: given a key and its value, it should be hard to find another key with the same value;
  • terminology:
  • * "map": Java, C++;
  • * "dictionary": Python, JavaScript, .NET;
  • * "associative array": PHP.
  • because maps are implemented using self-balancing red-black trees (explained below), all operations are done in O(log n); all hash table operations are constant.
  • Codeforces Problem Set

Graphs

A graph is a non-linear data structure representing a pair of two sets: G={V, E} , where V is the set of vertices (nodes), and E the set of edges (arrows). Nodes are values interconnected by edges - lines that depict the dependency (sometimes associated with a cost/distance) between two nodes.  There are two main types of graphs: directed and undirected. In an undirected graph, the edge (x, y) is available in both directions: (x, y) and (y, x) . In a directed graph, the edge (x, y) is called an arrow and the direction is given by the order of the vertices in its name: arrow (x, y) is different from arrow (y, x) .

 Graphs are the foundation of every type of network: a social network (like Facebook, LinkedIn), or even the network of streets from a city. Every user of a social media platform is a structure containing all of his/her personal data - it represents a node of the network. Friendships on Facebook are edges in an undirected graph (because it is reciprocal), while on Instagram or Twitter, the relationship between an account and its followers/following accounts are arrows in a directed graph (not reciprocal).

 Graph theory is a vast domain, but we are going to highlight a few of the most known concepts:

  • the degree of a node in an undirected graph is the number of its incident edges;
  • the internal/external degree of a node in a directed graph is the number of arrows that direct to/from that node;
  • a chain from node x to node y is a succesion of adjacent edges, with x as its left extremity and y as its right;
  • a cycle is a chain were x=y; a graph can be cyclic/acyclic; a graph is connected if there is a chain between any two nodes from V;
  • a graph can be traversed and processed using Breadth First Search (BFS) or Depth First Search (DFS), both done in O(|V|+|E|), where |S| is the cardinal of the set S; Check the links below for other essential info in graph theory.
  • Graph Editor
  • Wikipedia: Graphs - Discrete Mathematics
  • CS Academy: Graph representation

Trees

A tree is an undirected graph, minimal in terms of connectivity (if we eliminate a single edge the graph won't be connected anymore) and maximal in terms of acyclicity (if we add a single edge the graph won't be acyclic anymore). So any acyclic connected undirected graph is a tree, but for simplicity, we will refer to rooted trees as trees.  A root is one fixed node that establishes the direction of the edges in the tree, so that's where everything "starts". Leaves are the terminal nodes of the tree - that's where everything "ends".  A child of a vertice is its incident vertice below it. A vertice can have multiple children. A vertice's parent is its incident vertice above it - it's unique.

 We use trees anytime we should depict a hierarchy. Our own genealogical tree is the perfect example. Your oldest ancestor is the root of the tree. The youngest generation represents the leaves' set.   Trees can also represent the subordinate relationship in the company you work for. That way you can find out who is your manager and who you should manage.

  • the root has no parent;
  • leaves have no children;
  • the length of the chain between the root and a node x represents the level x is situated on;
  • the height of a tree is the maximum level of it (3 in our example);
  • the most common method to traverse a tree is DFS in O(|V|+|E|), but we can use BFS too; the order of the nodes traversed in any graph using DFS form the DFS tree that indicates us the time a node has been visited.
  • TutorialsPoint: Trees

8. Binary Trees & Binary Search Trees

BT

A Binary Tree is a special type of tree: each vertice can have maximum two children. In a strict binary tree, every node has exactly two children, except for the leaves. A complete binary tree with n levels has all 2ⁿ-1 possible nodes.  A binary search tree is a binary tree where nodes' values belong to a totally ordered set - any arbitrary chosen node's value is bigger than all the values from the left subtree and smaller than the ones from the right subtree.

 One important application of BTs is the representation and evaluation of logical expressions. Each expression can be decomposed into variables/constants and operators. This method of expression writing is called Reverse Polish Notation (RPN). That way, they can form a binary tree, where internal nodes are operators and leaves are variables/constants - it's called an Abstract Syntax Tree (AST).   BSTs are frequently used because of their fast search of keys property. AVL Trees, Red-Black Trees, ordered sets and maps are implemented using BSTs.

  • there are three types of DFS traversals for BTs:
  • * Preorder (Root, Left, Right);
  • * Inorder (Left, Root, Right);
  • * Postorder (Left, Right, Root); all done in O(n) time;
  • the inorder traversal gives us all the nodes in the tree in ascending order;
  • the left-most node is the minimum value in the BST and the rightmost is the maximum;
  • notice that RPN is the inorder traversal of the AST;
  • a BST has the advantages of a sorted array, but the disadvantage of logarithmic insertion - all of its operations are done in O(log n) time.
  • GeeksforGeeks: Binary Trees
  • GeeksforGeeks: Evaluation of Expression Trees
  • Medium: Best BST practice problems and interview questions

9. Self-balancing trees

AVL

All these types of trees are self-balancing binary search trees. The difference is in the way they balance their height in logarithmic time. AVL Trees are self-balancing after every insertion/deletion because the difference in module between the heights of the left subtree and the right subtree of a node is maximum 1. AVLs are named after their inventors: Adelson-Velsky and Landis. In Red-Black Trees, each node stores an extra bit representing color, used to ensure the balance after every insert/delete operation. In Splay trees, recently accessed nodes can be quickly accesed again, thus the amortized time complexity of any operation is still O(log n).

An AVL seems to be the best data structure in Database Theory. RBTs are used to organize pieces of comparable data, such as text fragments or numbers. In the version 8 of Java, HashMaps are implemented using RBTs. Data structures in computational geometry and functional programming are also built with RBTs. Splay trees are used for caches, memory allocators, garbage collectors, data compression, ropes (replacement of string used for long text strings), in Windows NT (in the virtual memory, networking, and file system code).

  • the amortized time complexity of ANY operation in ANY self-balancing BST is O(log n);
  • the maximum height of an AVL in worst case is 1.44 * log2n (Why? *hint: think about the case of an AVL with all levels full, except the last one that has only a single element);
  • AVLs are the fastest in practice for searching elements, but the rotation of subtrees for self-balancing is costly;
  • meanwhile, RBTs provide faster insertions and deletions because there are no rotations;
  • Splay trees don’t need to store any bookkeeping data.
  • GeeksforGeeks: AVL Trees
  • GeeksforGeeks: Red-Black Trees
  • GeeksforGeeks: Splay Trees

Heaps

A min-heap is a binary tree where each node has the property that its value is bigger or equal to its parent’s value: val[par[x]] <= val[x] , with x a node of the heap, where val[x] is its value and par[x] its parent. There is also a max-heap which implements the opposite relation. A binary heap is a complete binary tree (all its levels are filled, except maybe for the last level).

As we’ve discussed about it a few days earlier, priority queues can be efficiently implemented using a binary heap because it supports insert(), delete(), extractMax() and decreaseKey() operations in O(log n) time. That way, heaps are also essential in graph algorithms (because of the priority queue). Anytime that you would need quick access to the maximum/minimum item, a heap is the best option. Heaps are also the base of the heapsort algorithm.

  • it is always balanced: anytime we delete/insert an element in the structure, we just have to “sift”/”percolate” it until it is in the right position;
  • the parent of a node k > 1 is [k/2] (where [x] is the integer part of x) and its children are 2*k and 2*k+1 ;
  • an alternative of a priority queue are set, ordered_map (in C++) or any other ordered structure that can easily permit the access to the minimum/maximum element;
  • the root is prioritized, so the time complexity of its access is O(1), insertion/deletion are done in O(log n); creating a heap is done in O(n); heapsort in O(n*log n).
  • GeeksforGeeks: Heaps

Tries

A trie is an efficient information reTRIEval data structure. Also known as a prefix tree, it is a search tree which allows insertion and searching in O(L) time complexity, where L is the length of the key. If we store keys in a well balanced BST, it will need time proportional to L * log n, where n is the number of keys in the tree. That way, a trie is a way faster data structure (with O(L)) compared to a BST, but the penalty is on the trie storage requirements.

A trie is mostly used for storing strings and their values. One of its coolest application is the typing autocomplete & autosuggestions in the Google search bar. A trie is the best choice because it is the fastest option: a faster search is more valuable than the storage saved if we didn’t use a trie. Ortographical autocorrection of typed words is also done using a trie, by looking for the word in the dictionary or maybe for other instances of it in the same text.

  • it has a key-value association; the key is usually a word or a prefix of it, but it can be any ordered list;
  • the root has an empty string as a key;
  • the length difference between a node’s value and its children’s values is 1; that way, the root’s children will store a value of length 1; as a conclusion, we can say that a node x from a level k has a value of length k;
  • as we’ve said, the time complexity of insert/search operations is O(L), where L is the length of the key, which is way faster than a BST’s O(log n), but comparable to a hashtable;
  • space complexity is actually a disadvantage: O(ALPHABET_SIZE*L*n).
  • Medium: Trying to understand tries
  • GeeksforGeeks: Tries

12. Segment Trees

Segment Trees

A segment tree is a full binary tree that allows answering to queries efficiently, while still easily modifying its elements. Each element on index i in the given array represents a leaf labeled with the [i, i] interval. A node having its children labeled [x, y] , respectively [y, z] , will have the [x, z] interval as a label. Therefore, given n elements (0-indexed), the root of the segment tree will be labeled with [0, n-1] .

They are extremely useful in tasks that can be solved using Divide & Conquer (first Algorithms concept that we are going to discuss) and also might require updates on their elements. That way, while updating the element, any interval containing it is also modified, thus the complexity is logarithmic. For instance, the sum/maximum/minimum of n given elements are the most common applications of segment trees. Binary search can also use a segment tree if element updates are ocurring.

  • being a binary tree, a node x will have 2*x and 2*x+1 as children and [x/2] as a parent, where [x] is the integer part of x;
  • one efficient method of updating a whole range in a segment tree is called “Lazy Propagation” and it is also done in O(log n) (see links below for the implementation of the operations);
  • they can be k-dimensional : for example, having q queries of finding the sum of given submatrices of one matrix, we can use a 2-dimensional segment tree;
  • updating elements/ranges require O(log n) time; answering to a query is constant (O(1));
  • the space complexity is linear, which is a BIG advantage: O(4*n).
  • CP Agorithms: Segment Trees. Lazy propagation
  • GeeksforGeeks: Segment Trees

13. Fenwick Trees

BIT

A fenwick tree, also known as a binary indexed tree (BIT), is a data structure that is also used for efficient updates and queries. Compared to Segment Trees, BITs require less space and are easier to implement.

BITs are used to calculate prefix sums — the prefix sum of the element on the ith position is the sum of the elements from the first position to the ith. They are represented using an array, where every index is represented in the binary system. For instance, an index 10 is equivalent to an index 2 in the decimal system.

  • the construction of the tree is the most interesting part: firstly, the array should be 1-indexed; to find the parent of the node x, you should convert its index x to the binary system and flip the right-most significant bit; ex. the parent of node 6 is 4; 6 = 1*2²+1*2¹+0*2⁰ => 1"1"0 (flip)=> 100 = 1*2²+0*2¹+0*2⁰ = 4 ;
  • finally, ANDing elements, each node should contain an interval that can be added to the prefix sum (more about the construction and implementation in the links below);
  • the time complexity is still O(log n) for updates and O(1) on queries, but the space complexity is even a greater advantage: O(n), compared to segment tree’s O(4*n).
  • Tushar Roy: BIT
  • GeeksforGeeks: BIT
  • CP Algorithms: BIT

14. Disjoint Set Union

DSU

We are given n elements, each of them representing a separate set. Disjoint Set Union (DSU) permits us to do two operations:

  • UNION — combine any two sets (or unify the sets of two different elements if they’re not from the same set);
  • FIND — find the set an element comes from.

DSUs are very important in graph theory. You could check if two vertices come from the same connected component or maybe even unify two connected components. Let’s take the example of cities and towns. Since neighbour cities with demographical and economical growth are expanding, they can easily create a metropolis. Therefore, two cities are combined and their residents live in the same metropolis. We can also check what city a person lives in, by calling the FIND function.

  • they are represented using trees; once two sets are combined, one of the two roots becomes the main root and the parent of the other root is one of the other tree’s leaves;
  • one kind of practical optimization is the compression of trees by their height; that way, the union is made by the biggest tree to easily update both of their data (see implementation below);
  • all operations are done in O(1) time.

Useful links

  • GeeksforGeeks: DSU
  • CP Algorithms: DSU

15. Minimum Spanning Trees

MST

Given a connected and undirected graph, a spanning tree of that graph is a subgraph that is a tree and connects all the nodes together. A single graph can have many different spanning trees. A minimum spanning tree (MST) for a weighted, connected and undirected graph is a spanning tree with weight (cost) less than or equal to the weight of every other spanning tree. The weight of a spanning tree is the sum of weights given to each edge of the spanning tree.

The MST problem is an optimization problem, a minimum cost problem. Having a network of routes, we can consider that one of the factors that influence the establishment of a national route between n cities is the minimum distance between two adjacent cities. That way, the national route is represented by the MST of the roads network’s graph.

  • being a tree, an MST of a graph with n vertices has n-1 edges; it can be solved using:
  • * Prim’s Algorithm — best option for dense graphs (graphs with n nodes and the number of edges is close to n(n-1)/2 );
  • * Kruskal’s Algorithm — mostly used; it is a Greedy algorithm based on Disjoint Set Union (we are going to discuss about it too);
  • the time complexity of building it is O(n log n) or O(n log m) for Kruskal (it depends on the graph) and O(n²) for Prim.
  • CP Algorithms: MST
  • MST Tutorial

1. Divide and Conquer

Divide and Conquer (DAC) is not a specific algorithm itself, but an important category of algorithms that needs to be understood before diving into other topics. It is used to solve problems that can be divided into subproblems that are similar to the original problem, but smaller in size. DAC then recursively solves them and finally merges the results to find the solution of the problem. It has three stages:

  • Divide — the problems into subproblems;
  • Conquer — the subproblems by using recursion;
  • Merge — the subproblems’ results into the final solution.

What is it used for?

One practical application of DAC is parallel programming using multiple processors, so the subproblems are executed on different machines. DAC is the base of many algorithms such as Quick Sort, Merge Sort, Binary Search or fast multiplication algorithms.

  • each DAC problem can be written as a recurrence relation; so, it is essential to find the basic case that stops the recursion;
  • its complexity is T(n)=D(n)+C(n)+M(n) , meaning that every stage has a different complexity depending on the problem.
  • Divide and Conquer Implementation
  • GeeksforGeeks: DAC
  • Brilliant: DAC

2. Sorting Algorithms

A sorting algorithm is used to rearrange given elements (from an array or list) according to a comparison operator on the elements. When we refer to a sorted array, we usually think of ascending order (the comparison operator is ‘<’). There are various types of sorting, with different time and space complexities. Some of them are comparison based, others not. Here are the most popular/efficient sorting methods:

Bubble Sort

Bubble Sort is one of the simplest sorting algorithms. It is based on a repeated swap between adjacent elements if they are in wrong order. It is stable, its time complexity is O(n²) and it needs O(1) auxiliary space.

  • Bubble Sort Visualization

Counting Sort

Counting Sort is not a comparison based sorting. It is basically using the frequency of each element (a kind of hashing), determining the minimum and maximum value and then iterating between them to place each element based on its frequency. It’s done in O(n) and the space is proportional to the range of data. It is efficient if the range of input is not significantly greater than the number of elements.

  • Counting Sort Visualization

Quick Sort is an application of Divide and Conquer. It is based on choosing an element as a pivot (first, last or median) and then swapping elements in order to place the pivot between all the elements smaller than it and all the elements bigger than it. It has no additional space and O(n*log n) time complexity — the best complexity for comparison based methods. Here is a demo with choosing the pivot as the last element:

  • Quick Sort Visualization

Merge Sort is also a Divide & Conquer application. It divides the array in two halves, sorts each half and then merges them. Its time complexity is also O(n*log n), so it is also super fast like Quick Sort, but it unfortunately needs O(n) additional space to store two subarrays at the same time and, finally, merge them.

  • Merge Sort Visualization

Radix Sort uses Counting Sort as a subroutine, so it is not a comparison based algorithm. How do we know CS is not enough? Suppose we have to sort elements in [1, n²] . Using CS, it would take us O(n²). We need a linear algorithm — O(n+k), where elements are in range [1, k] . It sorts the elements digit by digit starting with the least significant one (units), to the most (tens, hundreds etc.). Additional space (from CS): O(n).

  • Radix Sort Visualization
  • Bubble Sort Implementation
  • Counting Sort Implementation
  • Quick Sort Implementation
  • Merge Sort Implementation
  • Radix Sort Implementation

3. Searching Algorithms

Searching Algorithms are designed to check for the existence of an element in a data structure and even return it. There are a couple of searching methods, but here are the most popular two:

Linear Search

This algorithm’s approach is very simple: you start searching for your value from the first index of the data structure. You compare them one by one until your value and your current element are equal. If that specific value is not in the DS, return -1. Time Complexity: O(n)

Binary Search

BS is one efficient search algorithm based on Divide and Conquer. Unfortunately, it only works only on sorted data structures. Being a DAC method, you continuously divide the DS in two halves and compare your in-search value with the middle element’s value. If they are equal, the search is finished. Either way, if your value is bigger/smaller than it, the search should continue on the right/left half. Time Complexity: O(log n)

  • Linear Search Implementation
  • Binary Search Implementation

4. Sieve of Eratosthenes

Given an integer number n, print all the prime numbers smaller or equal to n. Sieve of Eratosthenes is one of the most efficient algorithms that solves this problem and it perfectly works for n smaller than 10.000.000 . The method uses a frequency list/map that marks the primality of every number in the range [0, n] : ok[x]=0 if x is prime, ok[x]=1 otherwise. We begin choosing every prime number from our list and marking its multiples from the list with 1 — that way, we choose the unmarked (0) numbers. Finally, we can easily answer in O(1) to as many queries as we want. The classical algorithm is essential in many applications, but there are a few optimizations we can make. Firstly, we can easily notice 2 is the only even prime number, so we can check for its multiples separately and then iterate in the range in order to find prime numbers from two to two. Secondly, it is obvious that for a number x, we had previously checked 2x, 3x, 4x etc. when we were iterating through 2, 3 etc. That way, our multiples check for-loop can start from x² every time. Finally, even half of these multiples are even and we are also iterating through odd prime numbers, so we can easily iterate just from 2*x to 2*x in the multiples check loop. Space complexity: O(n) Time complexity: O(n*log(log n)) for the classical algorithm, O(n) for the optimized one. Why O(n*log(log n))? The answer

  • Sieve of Eratosthenes Implementation

5. Knuth-Morris-Pratt Algorithm

Given a text of length n and a pattern of length m, find all the occurrences of the pattern in the text. Knuth-Morris-Pratt Algorithm (KMP) is an efficient way to solve the pattern matching problem. The naive solution is based on using a “sliding window”, where we compare character to character every time we set a new beginning index, starting from index 0 of the text to index n-m. That way, time complexity is O(m*(n-m+1))~O(n*m). KMP is an optimization to the naive solution: it is done in O(n) and it is working the best when the pattern has many repeating subpatterns. Thereby, it is also using a sliding window, but instead of comparing all the characters to the substring’s, it is constantly looking for the longest suffix of the current subpattern which is also its prefix. In other words, anytime we detect a mismatch after some matches, we already know some of the characters in the text of the next window. Therefore, it is useless to match them again, so we restart the matching with the same character in the text with a character after that prefix. How do we know how many characters we should skip? Well, we should build a pre-process array that tells us how many characters should be skipped.

  • Tushar Roy: KMP Tutorial
  • KMP Implementation

The Greedy method is mostly used for problems that require optimization and the local optimal solution leads to the global optimal solution. That being said, when using Greedy, the optimal solution at each step leads to the overall optimal solution. However, in most cases, the decision we make at one step affects the list of decisions for the next step. In this case, the algorithm must be mathematically demonstrated. Greedy also produces great solutions on some mathematical problems, but not on all (it is possible that the most optimal solution is not guaranteed)!

A Greedy algorithm generally has five components:

  • a candidate set — from which a solution is created;
  • a selection function — chooses the best candidate;
  • a feasibility function — can determine if a candidate is able to contribute to the solution;
  • an objective function — assigns the candidate to the (partial) solution;
  • a solution function — builts the solution from the partial solutions.

Fractional Knapsack Problem

Given weights and values of n items, we need to put these items in a knapsack of capacity W to get the maximum total value in the knapsack (taking pieces of items is allowed: the value of a piece is proportional with its weight). The basic idea of the greedy approach is to sort all the items on basis of their value/weight ratio. Then, we can add as many whole items as we can. In the moment we find an item heavier (w2) than our available weight left in the knapsack (w1), we will fractionate it: take only w2-w1 of it to maximize our profit. It is guaranteed this greedy solution is correct.

  • Maximum number of non-overlapping intervals Implementation
  • Fractional Knapsack Problem Implementation

7. Dynamic Programming

Dynamic Programming (DP) is a similar approach to Divide & Conquer. It also breaks the problem into similar subproblems, but they are actually overlapping and codependent — they’re not solved independently. Each subproblem’s result can be used anytime later and it is built using memoization (precalculation). DP is mostly used for (time & space) optimization and it is based on finding a recurrence. DP applications include Fibonacci number series, Tower of Hanoi, Roy-Floyd-Warshall, Dijkstra etc. Below we are going to discuss about a DP solution of the 0–1 Knapsack Problem.

0–1 Knapsack Problem

Given weights and values of n items,we need to put these items in a knapsack of capacity W to get the maximum total value in the knapsack (fractioning items just as in the Greedy solution is not allowed). The 0–1 property is given by the fact that we should either pick the whole item or not choose it at all. We build a DP structure as a matrix dp[i][cw] storing the maximum profit that we can obtain by choosing i objects whose total weight is cw. It is easy to notice that we should firstly initialize dp[1][w[i]] with v[i] , where w[i] is the weight of the ith object and v[i] its value. The recurrence is the following: dp[i][cw] = max(dp[i-1][cw], dp[i-1][cw-w[i]]+v[i]) . Let’s analyze it a little bit. dp[i-1][cw] depicts the case in which we do not add the current item in the knapsack. dp[i-1][cw-w[i]]+v[i] is the case in which we add the item. That being said, dp[i-1][cw-w[i]] is the maximum profit of taking i-1 elements: so their weight is the current weight without our item’s weight. Finally, we add our item’s value to it. The answer is stored into dp[n][W] . An optimization is made with a simple observation: in the recurrence, the current line (row) is influenced only by the previous line. Therefore, storing the DP structure into a matrix is unnecessary, so we should choose an array for a better space complexity: O(n). Time complexity: O(n*W).

  • 0–1 Knapsack Problem Implementation

8. Longest Common Subsequence

Given two sequences, find the length of the longest subsequence present in both of them. A subsequence is a sequence that appears in the same relative order, but not necessarily contiguous. For example, “bcd”, “abdg”, “c” are subsequences of “abcdefg”. Here is another application of dynamic programming. The LCS algorithm uses DP in order to solve the problem from above. The actual subproblem is going to find the longest common subsequence that starts from index i in the sequence A, respectively from index j in the sequence B. Next, we will build the DP structure lcs[ ][ ] (matrix), where lcs[i][j] is the maximum length of a common subsequence that starts from index i in A, respectively index j in B. We are going to build it in a top-down manner. The solution is, obviously, stored in lcs[n][m] , where n is the length of A and m the length of B. The recurrence relation is pretty simple and intuitive. For simplicity, we are going to consider that both sequences are 1-indexed. Firstly, we are going to initialize lcs[i][0] , 1<=i<=n , and lcs[0][j] , 1<=j<=m , with 0, as basic cases (there is no subsequence that starts from 0). Then, we will take into consideration two main cases: if A[i] is equal to B[j] , then lcs[i][j] = lcs[i-1][j-1]+1 (one more identic character than the previous LCS). Otherwise, it will be the maximum between lcs[i-1][j] (if A[i] is not taken into consideration) and lcs[i][j-1] (if B[j] is not taken into consideration). Time Complexity: O(n*m) Additional Space: O(n*m)

  • LCS Implementation

9. Longest Increasing Subsequence

Given a sequence A of n elements, find the length of the longest subsequence such that all of its elements are sorted in increasing order. A subsequence is a sequence that appears in the same relative order, but not necessarily contiguous. For example “bcd”, “abdg”, “c” are subsequences of “abcdefg”. LIS is another classic problem that can be solved using Dynamic Programming. Finding the maximum length of an increasing subsequence is done using an array l[ ] as a DP structure, where l[i] is the maximum length of an increasing subsequence that contains A[i] , having its elements from the [A[i], …, A[n]] subsequence. l[i] is 1, if all the elements after A[i] are smaller than it. Otherwise, it’s 1+ maximum between all the elements after A[i] which are bigger than it. Obviously, l[n]=1 , where n is the length of A. The implementation is done in a bottom-up manner (starting from the end). One optimization problem appears in searching the maximum between all the elements after the current element. The best we can do is to binary search the maximum element. To also find a subsequence of the now known maximum length, we just have to use an additional array ind[ ] , that stores the index of each maximal value. Time Complexity: O(n*log n) Additional Space: O(n)

  • LIS Implementation

10. Convex Hull

Given a set of n points in the same plane, find the minimum area convex polygon that contains all of the given points (situated inside the polygon or on its sides). Such polygon is called a convex hull. The convex hull problem is a classic geometry that has many applications in real life. For instance, collision avoidance: if the convex hull of the car avoids collisions then so does the car. Computation of paths is done using convex representations of cars. Shape analysis is also done with the help of convex hulls. That way, image processing is easily done by matching models by their convex deficiency tree. There are some algorithms used to find the convex hull, like Jarvis’ Algorithm, Graham scanning etc. Today we are going to discuss about Graham scanning and some useful optimizations. Graham scanning sorts the points by their polar angle — the slope of the line determined by a certain point and the other chosen points. Then, a stack is used to store the convex hull at the current moment. When a point x is pushed into the stack, other points will be popped out of the stack until x and the line determined by the last two points form an angle smaller than 180°. Finally, the last point introduced into the stack closes the polygon. This approach has a time complexity of O(n*log n) because of sorting. However, this method can produce precision errors when calculating the slope. One improved solution that has the same time complexity, but smaller errors sorts the points by their coordinates (x, then y). Then we consider the line formed by the leftmost and rightmost points and the problem is divided in two subproblems. Finally, we find the convex hull on each side of the line. The convex hull of all the given points is the reunion of the two hulls.

  • Convex Hull Implementation

11. Graph Traversals

The problem of traversing graphs reffers to visiting all the nodes in a particular order, usually computing other useful information along the way.

Breadth-First Search

The Breadth-First Search (BFS) algorithm is one of the most common ways to determine if a graph is connected or not — or, in other words, to find the connected component of the source node of the BFS. BFS is also used to compute the shortest distance between the source node and all the other nodes. Another version of BFS is Lee’s Algorithm used to compute the shortest path between two cells in a grid. The algorithm starts by visiting the source node and then its neighbours that will be pushed into a queue. The first element from the queue is popped. We will visit all of its neighbours and push the ones that were not previously visited into the queue. The process is repeated until the queue is empty. When the queue becomes empty, it means that all the reachable vertices have been visited and the algorithm ends.

Depth-First Search

The Depth-First Search (DFS) algorithm is another common traversal method. It is actually the best option when it comes to checking the connectivity of a graph. First, we visit the root node and push it into a stack. While the stack is not empty, we examine the node at the top. if the node has unvisited neighbours, one of them is chosen and pushed in the stack. Otherwise, if all of its neighbours had been visited, we pop the node. When the stack becomes empty, the algorithm ends. After such traversal, a DFS tree is formed. The DFS tree has many applications; one of the most common is storing the “starting” and “ending” time of each node — the moment it enters the stack, respectively the moment it is popped out from it.

  • BFS Implementation
  • DFS Implementation
  • BFS Visualization
  • DFS Visualization

12. Floyd-Warshall Algorithm

The Floyd-Warshall / Roy-Floyd Algorithm solves the All Pairs Shortest Path problem: find the shortest distances between every pair of vertices in a given edge-weighted directed graph. FW is a Dynamic Programming application. The DP structure (matrix) dist[ ][ ] is initialized with the input graph matrix. Then we consider each vertex as an intermediate between other two nodes. The shortest paths are updated between every two pair of nodes, with any node k as an intermediate vertex. If k is an intermediate in the sortest path between i and j, dist[i][j] becomes the maximum between dist[i][k]+dist[k][j] and dist[i][j] . Time Complexity: O(n³) Space Complexity: O(n²)

  • FW Implementation

13. Dijkstra’s Algorithm & Bellman-Ford Algorithm

Dijkstra’s algorithm.

Given a graph and a source vertex in the graph, find the shortest paths from the source to all vertices in the given graph. Dijkstra’s Algorithm is used to find such paths in a weighted graph, where all weights are positive. Dijkstra is a Greedy algorithm that uses a shortest path tree (SPT) with the source node as the root. A SPT is a self-balancing binary tree, but the algorithm can be implemented using a heap (or a priority queue). We’re going to discuss about the heap solution, because its time complexity is O(|E|*log |V|). The idea is to work with an adjacency list representation of the graph. That way, the nodes will be traversed in O(|V|+|E|) time using BFS. All vertices are traversed with BFS and those for which the shortest distance is not finalized yet are stored into a Min-Heap (priority queue). The Min-Heap is created and every node is pushed into it along with their distance values. Then, the source becomes the root of the heap with a distance of 0. The other nodes will have infinite assigned as a distance. While the heap’s not empty, we extract the minimum distance value node x. For every vertex y adjacent to x, we check if y is in the Min-Heap. In this case, if the distance value is bigger than the weight of (x, y) plus distance value of x, then we update the distance value of y.

Bellman-Ford Algorithm

As we’ve previously said, Dijkstra works only on positively weighted graphs. Bellman solves this problem. Given a weighted graph, we can check if it contains a negative cycle. If not, then we can also find the minimum distances from our source to the others (negative weights possible). Bellman-Ford suites well for distributed systems, although its time complexity is O(|V| |E|). We initialize a dist[ ] just like in Dijkstra. For *|V|-1 times, for each (x, y) edge, if dist[y] > dist[x] + weight of (x, y) , then we update dist[y] with it. We repeat the last step to possibly find a negative cycle. The idea is that the last step guarantees the minimum distance if there is no negative cycle. If there is any node that has a shorter distance in the current step than in the last one, then a negative cycle was detected.

  • Dijkstra Implementation
  • BF Implementation

14. Kruskal’s Algorithm

We have previously discussed about what a Minimum Spanning Tree is. There are two algorithms that find the MST of a graph: Prim (useful for dense graphs) and Kruskal (ideal for most graphs). Now we are going to discuss about Kruskal’s Algorithm. Kruskal has developed a greedy algorithm in order to find an MST. It’s efficient on rare graphs, because its time complexity is O(|E|*log |V|). The algorithm’s approach is the following: we sort all the edges in increasing order of their weight. Then, the smallest edge is picked. If it does not form a cycle with the current MST, we include it. Otherwise, discard it. The last step is repeated until there are |V|-1 edges in the MST. The inclusion of edges into the MST is done using Disjoint-Set-Union, also previously discussed.

  • Kruskal Implementation

15. Topological Sorting

A Directed Acyclic Graph (DAG) is simply a directed graph which contains no cycles. Topological sorting in a DAG is a linear ordering of vertices such that for every arch (x, y) , node x comes before node y. Obviously, the first vertex in a topological sorting is a vertex with a 0 in-degree (there are no arches directing to it). Another special property is that a DAG doesn’t have a unique topological sorting. The BFS implementation follows this routine: a node with a 0 in-degree is found and pushed the first into the sorting. This vertex is removed from the graph. As the new graph is also a DAG, we can repeat the process.

At any point during DFS, a node can be in one of these three categories:

  • nodes that we finished visiting (popped from the stack);
  • nodes that are currently on the stack;
  • nodes that are yet to be discovered.

If during DFS in a DAG a node x has an outgoing edge to a node y, then y is either in the first or the third category. If y was on the stack, then (x, y) would end a cycle, fact that contradicts the DAG definition. This property actually tells us that a vertex is popped from the stack after all of its outgoing neighbours are popped. So to topological sort a graph, we need to keep track of a reversed order list of the popped vertices.

  • Topological Sorting Implementation

Woah, you have made it to the end of the article. Thanks for your attention! :) Have fun coding!

Top comments (28)

pic

Templates let you quickly answer FAQs or store snippets for re-use.

xtofl profile image

  • Location Belgium
  • Pronouns he/him/his
  • Joined Jun 21, 2018

A gigantic work.

Being a C++ nerd, I have to correct: std::map has logarithmic access complexity (mandated by the standard, e.g. see cppreference ). If you're looking for a constant complexity data structure, the 'hashmap' is std::unordered_map .

iuliagroza profile image

  • Email [email protected]
  • Location Zurich, Switzerland
  • Education Babes Bolyai University
  • Pronouns She/Her
  • Work Open to collaboration
  • Joined Aug 31, 2020

Thank you, well pointed out! I haven't noticed I considered the map's access operation to be done in O(1) (in the Maps presentation photo). As you've highlighted the logarithmic complexity, maps are indeed implemented using self-balancing trees (mentioned it in the properties). Going to fix my mistake.

codinglanguages profile image

  • Location Germany
  • Work DevOps Engineer at eBay
  • Joined Jun 17, 2020

Amazing compilation, congrats!

I think this article is a natural continuation of yours, where I show many problems that can be solved with these data structures and algorithms.

Definitely! Congrats, well-chosen techniques!

itsraghz profile image

  • Location Pune, Maharashtra, India
  • Education MS in Software Systems
  • Work Global Application Delivery Lead at Citi Corp Financial Services
  • Joined Sep 27, 2019

Wonderful piece of art Lulia :) Thanks for sharing. Really need time to digest this. :)

anzhari profile image

  • Location Tokyo, Japan
  • Education Masters of Science in Computer Science (ongoing)
  • Work Software Engineer
  • Joined Sep 6, 2020

I am brushing up my DSA skills again recently, and this is really useful. Appreciate the huge effort. 🔥💯

adminha profile image

  • Location California, United States
  • Joined Jul 14, 2023

Nice post, If you don't mind, I'm going to use some of your content to write an article on devban.com/ . Of course, with respect to copyrights and mentioning you as one of the sources.

phantas0s profile image

  • Location Berlin
  • Education Eternal learner
  • Joined Jul 28, 2018

Holy cow. That's an impressive article. I'm curious: did you learn all of that by yourself or did you do some CS studies?

Thank you! Focusing on DSA was a must because I took part in the National Olympiad in Informatics in high school, and it was definitely worth it :) .

ohdylan profile image

  • Location Singapore
  • Joined Mar 22, 2020

Good stuffs, thanks for the effort.

rightdroid profile image

  • Location Estonia
  • Education a bit trade school, mostly self-taught
  • Work Programmer at Stagnation Lab
  • Joined Dec 10, 2019

This is incredibly useful. Thanks for this!

goodevilgenius profile image

  • Location Houston, TX
  • Education Bachelor's, University of Texas @ Austin
  • Work Back-End Developer at GRIN
  • Joined Mar 15, 2019

I'm no expert on this, so I may be mistaken, but I believe there's a mistake in your Binary Search Tree diagram.

Binary Search Tree

Shouldn't the 20 be to the left of the 21, rather than the left of the 38?

Oh, I'm so sorry! It was a typo. It was 30 instead of 20 in my initial thread. Thank you for noticing! Fixed it! :)

You are right. Everything to the right of 21 should be greater (or equal to, if the tree contains duplicates) than 21.

Good catch!

danieluhl profile image

  • Email [email protected]
  • Location Boston
  • Work Developer Advocate at Wayfair
  • Joined Jan 10, 2019

This is really great, lots of stuff I've never heard of before. How did you create the diagrams?

Thanks! I use Adobe Spark.

badrilee profile image

  • Location Hyderabad
  • Joined Feb 17, 2020

programmerbyday profile image

  • Location Australia
  • Joined Nov 15, 2020

That was quite thorough.. especially the algorithms section

memnoch91 profile image

  • Joined Jun 25, 2019

Hei Iulia, amazing work and I've grateful to you for it.

I think you have a small miss-calculation at chapter 5 Maps & Hash Tables, there are only 1440 minutes in a day otherwise you meant something else by the 3600 minutes.

Huh, someone's missed their Maths classes 😂 . Thanks for reporting such errors! It's pretty hard to review such a big volume of information and readers' support is essential!

jjant profile image

  • Work Software Engineer doing Elm at ActiveState
  • Joined Jul 19, 2019

You don't need pre-image resistance for a Map's hash function, that's a cryptographic hash.

donmathi profile image

  • Location Denmark
  • Joined Oct 15, 2020

I came across a nice special tree algorithm, maybe it could fit into your list levelup.gitconnected.com/the-white...

Well-written article! I see a white-grey-black tree is quite similar to an AVL. Thanks for the suggestion! I will definitely consider adding it into a new article.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink .

Hide child comments as well

For further actions, you may consider blocking this person and/or reporting abuse

spiff profile image

Convert Images Into Pencil Sketch Using Python.

Ebikara Dandeson Spiff - Apr 11

Crafting an Image to PDF Converter App Using Python.

Calculator with gui using python tkinter..

nadiafedev profile image

Simple Browser in VS Code: My Coding Experience just Leveled Up!🙀

Nadia - Apr 5

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

The top data structures you should know for your next coding interview

The top data structures you should know for your next coding interview

by Fahim ul Haq

Niklaus Wirth, a Swiss computer scientist, wrote a book in 1976 titled Algorithms + Data Structures = Programs.

40+ years later, that equation still holds true. That’s why software engineering candidates have to demonstrate their understanding of data structures along with their applications.

Almost all problems require the candidate to demonstrate a deep understanding of data structures. It doesn’t matter whether you have just graduated (from a university or coding bootcamp), or you have decades of experience.

Sometimes interview questions explicitly mention a data structure, for example, “given a binary tree.” Other times it’s implicit, like “we want to track the number of books associated with each author.”

Learning data structures is essential even if you’re just trying to get better at your current job. Let’s start with understanding the basics.

What is a Data Structure?

Simply put, a data structure is a container that stores data in a specific layout. This “layout” allows a data structure to be efficient in some operations and inefficient in others. Your goal is to understand data structures so that you can pick the data structure that’s most optimal for the problem at hand.

Why do we need Data Structures?

As data structures are used to store data in an organized form, and since data is the most crucial entity in computer science, the true worth of data structures is clear.

No matter what problem are you solving, in one way or another you have to deal with data — whether it’s an employee’s salary, stock prices, a grocery list, or even a simple telephone directory.

Based on different scenarios, data needs to be stored in a specific format. We have a handful of data structures that cover our need to store data in different formats.

Commonly used Data Structures

Let’s first list the most commonly used data structures, and then we’ll cover them one by one:

  • Linked Lists
  • Tries (they are effectively trees, but it’s still good to call them out separately).
  • Hash Tables

An array is the simplest and most widely used data structure. Other data structures like stacks and queues are derived from arrays.

Here’s an image of a simple array of size 4, containing elements (1, 2, 3 and 4).

image-81

Each data element is assigned a positive numerical value called the Index , which corresponds to the position of that item in the array. The majority of languages define the starting index of the array as 0.

The following are the two types of arrays:

  • One-dimensional arrays (as shown above)
  • Multi-dimensional arrays (arrays within arrays)

Basic Operations on Arrays

  • Insert — Inserts an element at a given index
  • Get — Returns the element at a given index
  • Delete — Deletes an element at a given index
  • Size — Gets the total number of elements in an array

Commonly asked Array interview questions

  • Find the second minimum element of an array
  • First non-repeating integers in an array
  • Merge two sorted arrays
  • Rearrange positive and negative values in an array

We are all familiar with the famous Undo option, which is present in almost every application. Ever wondered how it works? The idea: you store the previous states of your work (which are limited to a specific number) in the memory in such an order that the last one appears first. This can’t be done just by using arrays. That is where the Stack comes in handy.

A real-life example of Stack could be a pile of books placed in a vertical order. In order to get the book that’s somewhere in the middle, you will need to remove all the books placed on top of it. This is how the LIFO (Last In First Out) method works.

Here’s an image of stack containing three data elements (1, 2 and 3), where 3 is at the top and will be removed first:

BP-lD2OxkMbIQI2iZD-jxgIPlANlsMTqwnLP

Basic operations of stack:

  • Push — Inserts an element at the top
  • Pop — Returns the top element after removing from the stack
  • isEmpty — Returns true if the stack is empty
  • Top — Returns the top element without removing from the stack

Commonly asked Stack interview questions

  • Evaluate postfix expression using a stack
  • Sort values in a stack
  • Check balanced parentheses in an expression

Similar to Stack, Queue is another linear data structure that stores the element in a sequential manner. The only significant difference between Stack and Queue is that instead of using the LIFO method, Queue implements the FIFO method, which is short for First in First Out.

A perfect real-life example of Queue: a line of people waiting at a ticket booth. If a new person comes, they will join the line from the end, not from the start — and the person standing at the front will be the first to get the ticket and hence leave the line.

Here’s an image of Queue containing four data elements (1, 2, 3 and 4), where 1 is at the top and will be removed first:

C2riLJTPBVpSI-3o5Cx9IrQ16LZi1kLrqYXo

Basic operations of Queue

  • Enqueue() — Inserts an element to the end of the queue
  • Dequeue() — Removes an element from the start of the queue
  • isEmpty() — Returns true if the queue is empty
  • Top() — Returns the first element of the queue

Commonly asked Queue interview questions

  • Implement stack using a queue
  • Reverse first k elements of a queue
  • Generate binary numbers from 1 to n using a queue

Linked List

A linked list is another important linear data structure which might look similar to arrays at first but differs in memory allocation, internal structure and how basic operations of insertion and deletion are carried out.

A linked list is like a chain of nodes, where each node contains information like data and a pointer to the succeeding node in the chain. There’s a head pointer, which points to the first element of the linked list, and if the list is empty then it simply points to null or nothing.

Linked lists are used to implement file systems, hash tables, and adjacency lists.

Here’s a visual representation of the internal structure of a linked list:

ezrkbpSyblh3famnGsgIHiRvHV9CKODu0tPw

Following are the types of linked lists:

  • Singly Linked List (Unidirectional)
  • Doubly Linked List (Bi-directional)

Basic operations of Linked List:

  • InsertAtEnd — Inserts a given element at the end of the linked list
  • InsertAtHead — Inserts a given element at the start/head of the linked list
  • Delete — Deletes a given element from the linked list
  • DeleteAtHead — Deletes the first element of the linked list
  • Search — Returns the given element from a linked list
  • isEmpty — Returns true if the linked list is empty

Commonly asked Linked List interview questions

  • Reverse a linked list
  • Detect loop in a linked list
  • Return Nth node from the end in a linked list
  • Remove duplicates from a linked list

A graph is a set of nodes that are connected to each other in the form of a network. Nodes are also called vertices. A pair(x,y) is called an edge , which indicates that vertex x is connected to vertex y . An edge may contain weight/cost, showing how much cost is required to traverse from vertex x to y .

0MsvzasAr6vS6bnvozjRAa5iBnEDKn9Cty0D

Types of Graphs:

  • Undirected Graph
  • Directed Graph

In a programming language, graphs can be represented using two forms:

  • Adjacency Matrix
  • Adjacency List

Common graph traversing algorithms:

  • Breadth First Search
  • Depth First Search

Commonly asked Graph interview questions

  • Implement Breadth and Depth First Search
  • Check if a graph is a tree or not
  • Count the number of edges in a graph
  • Find the shortest path between two vertices

A tree is a hierarchical data structure consisting of vertices (nodes) and edges that connect them. Trees are similar to graphs, but the key point that differentiates a tree from the graph is that a cycle cannot exist in a tree.

Trees are extensively used in Artificial Intelligence and complex algorithms to provide an efficient storage mechanism for problem-solving.

Here’s an image of a simple tree, and basic terminologies used in tree data structure:

VPUnmQO8rMoLGMqMe24EnoJ3uS72JZdMt48w

The following are the types of trees:

  • Balanced Tree
  • Binary Tree
  • Binary Search Tree
  • Red Black Tree

Out of the above, Binary Tree and Binary Search Tree are the most commonly used trees.

Commonly asked Tree interview questions

  • Find the height of a binary tree
  • Find kth maximum value in a binary search tree
  • Find nodes at “k” distance from the root
  • Find ancestors of a given node in a binary tree

Trie, which is also known as “Prefix Trees”, is a tree-like data structure which proves to be quite efficient for solving problems related to strings. It provides fast retrieval, and is mostly used for searching words in a dictionary, providing auto suggestions in a search engine, and even for IP routing.

Here’s an illustration of how three words “top”, “thus”, and “their” are stored in Trie:

lSNi21Wr4P6eMKDwLMQ5rijHhA-lBlovlc40-1

The words are stored in the top to the bottom manner where green colored nodes “p”, “s” and “r” indicates the end of “top”, “thus”, and “their” respectively.

Commonly asked Trie interview questions:

  • Count total number of words in Trie
  • Print all words stored in Trie
  • Sort elements of an array using Trie
  • Form words from a dictionary using Trie
  • Build a T9 dictionary

Hashing is a process used to uniquely identify objects and store each object at some pre-calculated unique index called its “key.” So, the object is stored in the form of a “key-value” pair, and the collection of such items is called a “dictionary.” Each object can be searched using that key. There are different data structures based on hashing, but the most commonly used data structure is the hash table .

Hash tables are generally implemented using arrays.

The performance of hashing data structure depends upon these three factors:

  • Hash Function
  • Size of the Hash Table
  • Collision Handling Method

Here’s an illustration of how the hash is mapped in an array. The index of this array is calculated through a Hash Function.

zV3x2Pxt0JFt7UjokTKNx24HFmM3t-6phDV2

Commonly asked Hashing interview questions

  • Find symmetric pairs in an array
  • Trace complete path of a journey
  • Find if an array is a subset of another array
  • Check if given arrays are disjoint

The above are the top eight data structures that you should definitely know before walking into a coding interview.

If you are looking for resources on data structures for coding interviews, look at the interactive & challenge based courses: Data Structures for Coding Interviews ( Python , Java , or JavaScript ).

For more advanced questions, look at Coderust 3.0: Faster Coding Interview Preparation with Interactive Challenges & Visualizations .

If you are preparing for a software engineering interviews, here’s a comprehensive roadmap to prepare for coding Interviews .

Good luck and happy learning! :)

If this article was helpful, share it .

Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started

Introducing Data Structures with Java by David Cousins

Get full access to Introducing Data Structures with Java and 60K+ other titles, with a free 10-day trial of O'Reilly.

There are also live events, courses curated by job role, and more.

Case Study 4—A Queue Simulation

17.1 introduction.

Chapter 10 introduced the topic of queues including the priority queue, which holds items in the order of some defined criterion. This case study will build an application to simulate such a queue. It also includes the process of writing data to a disk file as described in Chapter 4 .

17.2 THE APPLICATION

Checking in for a flight includes being given a boarding card printed with a seat number for the aircraft cabin. However, many low-cost airline operators do not allocate seats at check-in, leaving passengers to pick one when they board instead. An attempt is made to avoid a free-for-all from developing as a result, as follows:

When booking a budget flight, it is often possible at extra cost ...

Get Introducing Data Structures with Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.

Don’t leave empty-handed

Get Mark Richards’s Software Architecture Patterns ebook to better understand how to design components—and how they should interact.

It’s yours, free.

Cover of Software Architecture Patterns

Check it out now on O’Reilly

Dive in for free with a 10-day trial of the O’Reilly learning platform—then explore all the other resources our members count on to build skills and solve problems every day.

data structures case study topics

Browse Course Material

Course info.

  • Prof. Erik Demaine

Departments

  • Electrical Engineering and Computer Science

As Taught In

  • Algorithms and Data Structures

Learning Resource Types

Advanced data structures, course description.

Data structures play a central role in modern computer science. You interact with data structures even more often than with algorithms (think Google, your mail server, and even your network routers). In addition, data structures are essential building blocks in obtaining efficient algorithms. This course covers major …

Data structures play a central role in modern computer science. You interact with data structures even more often than with algorithms (think Google, your mail server, and even your network routers). In addition, data structures are essential building blocks in obtaining efficient algorithms. This course covers major results and current directions of research in data structure.

Acknowledgments

Thanks to videographers Martin Demaine and Justin Zhang.

Billy has redecorated. He tells his parents that now the Christmas tree has a heap of presents underneath!  His mom tells him he will not be invited home next year.

You are leaving MIT OpenCourseWare

Library Home

Open Data Structures: An Introduction

(3 reviews)

data structures case study topics

Pat Morin, Carleton University

Copyright Year: 2013

ISBN 13: 9781927356388

Publisher: Athabasca University Press

Language: English

Formats Available

Conditions of use.

Attribution-NonCommercial-NoDerivs

Learn more about reviews.

Reviewed by Joseph Jess, Faculty, Linn-Benton Community College on 1/14/20

The text covers all areas I would expect to see in an introduction to data structures (lists, trees, hash tables, graphs, supporting searching and sorting algorithms for relevant structures, and plenty of complexity analysis) with a variety of... read more

Comprehensiveness rating: 5 see less

The text covers all areas I would expect to see in an introduction to data structures (lists, trees, hash tables, graphs, supporting searching and sorting algorithms for relevant structures, and plenty of complexity analysis) with a variety of variations on the structures and some reasoning as to why we might want to use these variations. The table of contents and term-based index have enough detail especially considering the organized structure of the book.

Content Accuracy rating: 4

The contents are accurate, I found no obvious errors, and at least mentions and gives brief examples of the background information needed to be most successful with the materials; though having some explanation on some of the common proof techniques used with data structures that we use could be beneficial as well (there is some mention of this in the mathematical background section but not much of the reasoning behind why we care about this analysis).

Relevance/Longevity rating: 5

The content is very relevant for an introduction to data structures, needing to cover the simpler version of these structures and then provide a few variations from the many decades of basic materials covered; this will hopefully show students that this is an area that is still being researched heavily. Updating the basics I expect to be rare, and a perfect starting point for using these structures in other related areas while allowing new developments (and far far more detailed than some of these basic structures) to be covered in a separate text or other resource.

Clarity rating: 4

The text is written in prose accessible to someone with perhaps a year of academic courses in computer science, but does lean somewhat on someone having solved problems either programmatically or having a good deal of mathematical background. The jargon is light and well explained, though their variables for the code examples could be greatly improved...

Consistency rating: 5

The book is very consistent with regards to terminology and framework, I greatly appreciate the regular use of diagrams showing the sequence of actions for an operation to complete (something I frequently draw out on a whiteboard or digital tablet for students).

Modularity rating: 4

The text is readily divisible into smaller reading sections, though you would want to be careful about jumping beyond certain sections before knowing someone had taken in some of the key concepts from a simpler set of structures (perhaps broken into the sections on lists, then hashes and trees, then graphs and sorting, then structures for integers and external memory searching), since they sometimes build on a key concept (such as a simple linked-list node, then a binary tree node, then a more general node).

Organization/Structure/Flow rating: 5

The topics are in a logical order, and so long as someone pauses to ask what the key behaviors and components of a structure are should then be able to see the next section adding either a variation on what we already have access to or roughly one new feature to some of the components we have access to.

Interface rating: 5

The contents look great!

Grammatical Errors rating: 5

The English contents follow English grammar rules well, and the simplified code examples should be easily followed by someone having worked with a C-based language or a good deal of mathematics before.

Cultural Relevance rating: 5

The text is not culturally insensitive or offensive to me; though it does not make use of virtually any examples or variety of race, ethnicity, or background.

I plan to use this as a supporting text for my own data structures course with the many explanations for why we study each structure and why we care about each section we analyze or implement ourselves; with it covering all the major topics that I do in class and having variations that I do not bring up in class due to time constraints.

Reviewed by Breeann Flesch, Associate Professor of Computer Science, Western Oregon University on 2/25/19

This book covers all of the topics typical in an introductory data structures class (complexity, sorts, stacks, queues, binary search trees, heaps, hash tables, etc). read more

This book covers all of the topics typical in an introductory data structures class (complexity, sorts, stacks, queues, binary search trees, heaps, hash tables, etc).

Content Accuracy rating: 5

The book is thorough and accurate, including relevant mathematical topics for background information.

Since this course covers the foundations of computer science, it is likely to be relevant for a long time.

Clarity rating: 5

The book has lots of examples and pictures. The code examples are based on Java, but have been simplified enough to consider them language-agnostic pseudocode.

Consistency rating: 4

The book's definitions and notation are consistent throughout.

It would be easy to assign smaller chunks for scaffolding. However, many topics do build upon previous sections, so it may be difficult to jump around or skip sections.

The book is organized well, making sure that topics build in a logical order.

The entire book seemed to display well with my pdf reader.

Grammatical Errors rating: 4

The text contains few grammatical errors.

This book is as culturally sensitive as makes sense for a data structures text.

Overall, this book is comprehensive and accurate. I will use it for my data structure classes in the future.

Reviewed by Andrew Black, Professor, Portland State University on 8/21/16

It does a very thorough job of describing data structures for stacks, queues, lists, sets, and “sortedSets” —&nbsp;the latter not exactly a standard mathematical structure, but quite a useful one for many algorithms. It also has chapters on... read more

It does a very thorough job of describing data structures for stacks, queues, lists, sets, and “sortedSets” — the latter not exactly a standard mathematical structure, but quite a useful one for many algorithms. It also has chapters on Priority queues, sorting, graph representation and traversal, tries, and B-trees. The treatment of the basic data structures for lists and sets is unusually comprehensive, covering not just linear lists but also skiplists, hash tables, and various kinds of tree. The chapter on hashing covers not just hash tables, but also the construction of hash functions, a topic that is often omitted in texts.

It also contains some introductory material on asymptotic notation, randomization and probability. My feeling that this material would be a useful refresher for a student (or a professor!) who hadn’t used this kind of mathematics for a while, but that it would by itself be inadequate as an introduction. This may be a reflection on the different levels of math education expected at a university in Canada vs on in the USA.

I didn’t find any errors in the book, and feel that it is accurate. However, I did not read all of the later chapters in detail, and certainly did not check the proofs. Its treatment of Quicksort is much better than that of many algorithms books, since it assumes from the start (as did Hoare in the original papers) that the pivot must be chosen randomly. I was a little disappointed, though, to see that one other feature of Quicksort, which I consider obligatory, was omitted — the double-ended traversal in the partition algorithm,which reduces the number of swaps by roughly half compared to a single-ended traversal. This can’t be considered a bug, though, because the book does not include an analysis of the number of swaps, only of the number of comparisons, even though the latter is a much less expensive operation.

Relevance/Longevity rating: 4

This material is pretty stable. The book does not include some of the more recent development, such as dual-pivot Quicksort, but the topic of data structures moves so quickly that it would be impossible to include every new development. In any case, this would not be appropriate in a textbook.

The text is written in lucid, accessible prose. Sometimes I was left wanting a little more context. For example, in the discussion of multiplicative hashing, a couple of sentences describing the goal (mixing up the bits of the input) and the mechanism (selecting some of the “middle” bits of the product of the input and a randomly-chosen constant) would have been useful, as a prelude to the detailed discussion of the mechanism.

With a very few exceptions, the text is internally consistent in terms of terminology and framework. There is just one place where I noticed the consistency breaking down, in the section on random Binary Search Trees, where there seems to be some confusion between _element n_ and the element with _rank n_.

All the chapters depend the interfaces, computational model and analysis techniques defined in Chapter 1. Apart from that, the other chapters are largely self-contained. This is about as good as could be expected. However, two of the names given to the interfaces in chapter 1 are obscure. Everyone knows what a Queue and a Stack are, but what's an SSet? Every time I came back to the book after working on something else, I had to remind myself what a USet and and SSet were. This is so unnecessary. It turns out that a USet is just a mutable Set, while an SSet is a mutable Sorted Set. Using the slightly longer names would make this book much more useful as a reference.

Generally, the book is very well organized, working form simple and straightforward (not no necessarily fast) data structures to complex one that have better amortized performance. By only objection is to chapter 13, which is titled Data Structures for Integers, but which deals with Tries. I tend to think of Tries as a data structure for variable-length strings, although they can certainly be used for integers too.

It's a very nice looking text.

Excellent! And I'm a picky reviewer.

The text is not culturally insensitive or offensive in any way that I observed.

I enjoyed reading it — this is important.

Table of Contents

  • 1 Introduction
  • 2 Array-Based Lists
  • 3 Linked Lists
  • 4 Skiplists
  • 5 Hash Tables
  • 6 Binary Trees
  • 7 Random Binary Search Trees
  • 8 Scapegoat Trees
  • 9 Red-Black Trees
  • 11 Sorting Algorithms
  • 13 Data Structures for Integers
  • 14 External Memory Searching

Ancillary Material

About the book.

Offered as an introduction to the field of data structures and algorithms, Open Data Structures covers the implementation and analysis of data structures for sequences (lists), queues, priority queues, unordered dictionaries, ordered dictionaries, and graphs. Focusing on a mathematically rigorous approach that is fast, practical, and efficient, Morin clearly and briskly presents instruction along with source code.

Analyzed and implemented in Java, the data structures presented in the book include stacks, queues, deques, and lists implemented as arrays and linked-lists; space-efficient implementations of lists; skip lists; hash tables and hash codes; binary search trees including treaps, scapegoat trees, and red-black trees; integer searching structures including binary tries, x-fast tries, and y-fast tries; heaps, including implicit binary heaps and randomized meldable heaps; graphs, including adjacency matrix and adjacency list representations; and B-trees.

A modern treatment of an essential computer science topic, Open Data Structures is a measured balance between classical topics and state-of-the art structures that will serve the needs of all undergraduate students or self-directed learners.

About the Contributors

Pat Morin is Professor in the School of Computer Science at Carleton University as well as founder and managing editor of the open access Journal of Computational Geometry. He is the author of numerous conference papers and journal publications on the topics of computational geometry, algorithms, and data structures.

Contribute to this Page

Popular Articles

  • Why Data Structure Is Important In Programming (Nov 30, 2023)
  • Data Structure Stack Algorithm (Nov 30, 2023)
  • Data Structures Important Topics (Nov 30, 2023)
  • Data Structure And Data Type Difference (Nov 30, 2023)
  • Which Language Is Better For Data Structure (Nov 30, 2023)

Data Structures Important Topics

Switch to English

Table of Contents

Introduction

Linked lists, stacks and queues, tips and tricks, common errors and how to avoid them.

  • Arrays are the simplest data structure that stores elements of the same type. They can be accessed directly by their index, making them extremely efficient for lookups. However, arrays have a fixed size and are not suitable for data sets that might grow unpredictably.
  • When data sets need to grow and shrink dynamically, linked lists come in handy. They consist of nodes that hold data and a reference (or link) to the next node. They are flexible for insertions and deletions but provide slower access to individual elements.
  • Stacks and queues are dynamic sets of elements that follow particular access patterns. A queue follows the FIFO (First In First Out) rule, while a stack follows the LIFO (Last In First Out) rule. These structures are often used in algorithm design, such as depth-first search (DFS) for stacks and breadth-first search (BFS) for queues.
  • Trees are another form of linked data structure where each node is connected to multiple nodes. It is used for representing hierarchical relationships and organizing data in a sorted manner. Binary trees, BSTs (Binary Search Trees), AVL trees, and B-trees are some of the common types of trees.
  • A graph is a set of nodes that are connected by edges. Graphs can be used to represent network structures, such as social networks, web pages, etc. Graphs can be either directed or undirected, and they can also contain cycles.
  • Always choose the right data structure for your problem. Using an array where a linked list is needed, or vice versa, can lead to inefficient solutions.
  • Be aware of the trade-off between time and space. For instance, arrays provide quick access but use more memory, while linked lists use less memory but access is slower.
  • Consider the worst-case scenario when analyzing the efficiency of your data structure - this will help you understand its performance better.
  • Off-by-one errors: These are common in data structures like arrays and linked lists. Always make sure your indices and pointers are within the valid range.
  • Memory leaks: When using dynamic data structures like linked lists or trees, always ensure that memory is properly freed to avoid memory leaks.
  • Circular references: If you're working with graphs or doubly-linked lists, be careful of circular references. It can cause infinite loops and crashes.

Distributed data structures: A case study

Ieee account.

  • Change Username/Password
  • Update Address

Purchase Details

  • Payment Options
  • Order History
  • View Purchased Documents

Profile Information

  • Communications Preferences
  • Profession and Education
  • Technical Interests
  • US & Canada: +1 800 678 4333
  • Worldwide: +1 732 981 0060
  • Contact & Support
  • About IEEE Xplore
  • Accessibility
  • Terms of Use
  • Nondiscrimination Policy
  • Privacy & Opting Out of Cookies

A not-for-profit organization, IEEE is the world's largest technical professional organization dedicated to advancing technology for the benefit of humanity. © Copyright 2024 IEEE - All rights reserved. Use of this web site signifies your agreement to the terms and conditions.

data structures case study topics

I learned all data structures in a week. This is what it did to my brain.

Jain Doe

Over the last week, I studied seven commonly used data structures in great depth. In the last 3 years since I first studied about them during my undergraduate studies, I felt no glimmer of temptation to study any one of them again; it wasn’t the complex concepts which kept me away, but their lack of usage in my day to day coding. Every data structure I’ve ever used was built into the language. And I’ve forgotten how they worked under the hood.

They were inescapable now. There are seven data structure in the series to be studied.

Let us go back to where it all began. Like every invention has a necessity, and having data structures also had one.

Say you’ve to find a specific book in an unorganized library. You’ve put in numerous hours in shuffling, organizing and searching for the book. The next day the librarian walks in, looks at the mess you’ve created and organizes the library in a different way.

Problem? Just like you can organize books in a library in 100 different ways, you can structure data in 100 different ways. So, we need to find a way to organize our books(read: data) so that we can find our book(read: data) in a very efficient and fastest way.

Luckily for us, some uber smart people have built great structures that have stood the test of time and help us solve our problem. All we need to know how they work and use them. We call them data structures . Accessing, inserting, deleting, finding, and sorting the data are some of the well-known operations that one can perform using data structures.

The first entry in the series ‘ Array’ leaves no need to have multiple data structures. And yet there will be so many more. I do not have the energy to describe why one data structure triumph over another one. But, I’ll be honest with you: it does matter knowing multiple data structures.

Still not convinced?

Let’s try to solve few operations with our beloved array. You want to find something in an array, just check every slot. Want to insert anything in middle? You can move every element to make room.

Easy-peasy, right?

The thing is “all of these are slow”. We want to find/sort/insert data efficiently and in the fastest possible way. An algorithm may want to perform these operations a million of times. If you can’t do them efficiently, many other algorithms are inefficient . As it turns out, you can do lots of things faster if you arrange the data differently.

You may think, “Ah, but what if they ask me trivia questions about which data structure is most important or rank them”

At which point I must answer: At any rate, should that happen, just offer them this — the ranking of the data structures will be at least partially tied to problem context. And never ever forget to analyze time and space performance of the operations.

But if you want a ranking of learning different data structures, below is the list from most tolerable to “oh dear god”

  • Linked List
  • Hash Tables

You will need to keep the graph and trees somewhere near the end, for, I must confess: it is huge and deals with zillions of concepts and different algorithms.

Maps or arrays are easy. You’ll have a difficult time finding a real-world application that doesn’t use them. They are ubiquitous.

As I worked my way through other structures, I realized one does not simply eat the chips from the Pringles tube, you pop them. The last chip to go in the tube is the first one to go in my stomach(LIFO) . The pearl necklace you gifted your Valentine is nothing but a circular linked list with each pearl containing a bit of data. You just follow the string to the next pearl of data, and eventually, you end up at the beginning again.

Our Brain somehow makes the leap from being the most important organ to one of the world’s best example of a linked list . Consider the thinking process when you placed your car keys somewhere and couldn’t remember.Our brain follows association and tries to link one memory with another and so on and we finally recall the lost memory.

We are connected on Medium. Thank you, Graphs. When a data structure called trees goes against nature’s tradition of having roots at the bottom, we accept it handily. Such is the magic of data structures. There is something ineffable about them — perhaps all our software are destined for greatness. We just haven’t picked the right data structure.

Here, in the midst of theoretical concepts is one of the most nuanced and beautiful real-time examples of the stacks and queues data structure I’ve seen in real life.

Browser back/forward button and browsing history

As we navigate from one web page to another, those pages are placed on a stack. The current page that we are viewing is on the top and the first page we looked at is at the base. If we click on the Back button, we begin to move in reverse order through the pages. A queue is used for Browsing history. New pages are added to history. Old pages removed such as in 30 days

Now pause for a moment and imagine how many times we, as both a user and developer, use stacks and queues. That is amazing, right?

But, my happiness was short-lived. As I progressed with the series, I realized we have a new data structure based on a doubly-linked list that handles browser back and forward functionality more efficiently in O(1) time.

That is the problem with the data structures. I am touched and impressed by a use case, and then everyone starts talking about why one should be preferred over other based on time complexities and I feel my brain cells atrophying.

In the end, I am left not knowing what to do. I can’t look at the things the same way ever again. Maps are graphs. Trees look upside down. I pushed my article in Codeburst’s queue to be published. I wish they introduced something like prime/priority writers, which might help me jump the queue. These data structures look absolutely asinine yet I cannot stop talking/thinking about them. Please help.

Thanks for reading! If you liked this post, you can check out my other writings here or please consider entering your email here if you’d like to be added to my once-weekly email list.You can also follow me on Twitter , Linkedin & Github

If this post was helpful, please click the clap button below a few times to show your support!

✉️ Subscribe to CodeBurst’s once-weekly Email Blast , 🐦 Follow CodeBurst on Twitter , view 🗺️ The 2018 Web Developer Roadmap , and 🕸️ Learn Full Stack Web Development .

Jain Doe

Written by Jain Doe

More from jain doe and codeburst.

The Ultimate Beginners Guide To Analysis of Algorithm

The Ultimate Beginners Guide To Analysis of Algorithm

The other day, i came across a post on stackoverflow which read “is theoretical computer science(tcs) useful”. i was completely caught off….

How To Create Horizontal Scrolling Containers

How To Create Horizontal Scrolling Containers

As a front end developer, more and more frequently i am given designs that include a horizontal scrolling component. this has become….

Top 50 Java Interview Questions for Beginners and Junior Developers

Top 50 Java Interview Questions for Beginners and Junior Developers

A list of frequently asked java questions and answers from programming job interviews of java developers of different experience..

Jinja2 Explained in 5 Minutes!

Jinja2 Explained in 5 Minutes!

(part 4: back-end web framework: flask), recommended from medium.

Advice From a Software Engineer With 8 Years of Experience

Benoit Ruiz

Better Programming

Advice From a Software Engineer With 8 Years of Experience

Practical tips for those who want to advance in their careers.

Practical Tips for Job Searching

Practical Tips for Job Searching

In the ever-changing landscape of the job market, finding a new job can seem like a challenging expedition. i’ve had the privilege of….

data structures case study topics

General Coding Knowledge

data structures case study topics

Stories to Help You Grow as a Software Developer

data structures case study topics

Coding & Development

data structures case study topics

Apple's Vision Pro

What I Learned From Thinking Fast And Slow

Startup Stash

What I Learned From Thinking Fast And Slow

Quite possibly the single most important book ever written for data scientists, decision makers, and everyone else..

What Happens When You Start Reading Every Day

Sufyan Maan, M.Eng

ILLUMINATION

What Happens When You Start Reading Every Day

Think before you speak. read before you think. — fran lebowitz.

I Solved 300+ Leetcode problems , Here is what I learnt.

I Solved 300+ Leetcode problems , Here is what I learnt.

Why I Keep Failing Candidates During Google Interviews…

Alexander Nguyen

Level Up Coding

Why I Keep Failing Candidates During Google Interviews…

They don’t meet the bar..

Text to speech

Library homepage

  • school Campus Bookshelves
  • menu_book Bookshelves
  • perm_media Learning Objects
  • login Login
  • how_to_reg Request Instructor Account
  • hub Instructor Commons
  • Download Page (PDF)
  • Download Full Book (PDF)
  • Periodic Table
  • Physics Constants
  • Scientific Calculator
  • Reference & Cite
  • Tools expand_more
  • Readability

selected template will load here

This action is not available.

Engineering LibreTexts

4: Case Study- Data Structure Selection

  • Last updated
  • Save as PDF
  • Page ID 15438

  • Allen B. Downey
  • Olin College via Green Tea Press
  • 4.1: Word Frequency Analysis
  • 4.2: Random Numbers
  • 4.3: Word Histogram
  • 4.4: Most Common Words
  • 4.5: Optional Parameters
  • 4.6: Dictionary Subtraction
  • 4.7: Random Words
  • 4.8: Markov Analysis
  • 4.9: Data Structures
  • 4.10: Debugging
  • 4.11: Glossary
  • 4.12: Exercises

Segment Trees

The lessons learned from optimizing binary search can be applied to a broad range of data structures.

In this article, instead of trying to optimize something from the STL again, we focus on segment trees , the structures that may be unfamiliar to most normal programmers and perhaps even most computer science researchers 1 , but that are used very extensively in programming competitions for their speed and simplicity of implementation.

(If you already know the context, jump straight to the last section for the novelty: the wide segment tree that works 4 to 12 times faster than the Fenwick tree.)

# Dynamic Prefix Sum

Segment trees are cool and can do lots of different things, but in this article, we will focus on their simplest non-trivial application — the dynamic prefix sum problem :

As we have to support two types of queries, our optimization problem becomes multi-dimensional, and the optimal solution depends on the distribution of queries. For example, if one type of the queries were extremely rare, we would only optimize for the other, which is relatively easy to do:

  • If we only cared about the cost of updating the array , we would store it as it is and calculate the sum directly on each sum query.
  • If we only cared about the cost of prefix sum queries , we would keep it ready and re-calculate them entirely from scratch on each update.

Both of these options perform $O(1)$ work on one query type but $O(n)$ work on the other. When the query frequencies are relatively close, we can trade off some performance on one type of query for increased performance on the other. Segment trees let you do exactly that, achieving the equilibrium of $O(\log n)$ work for both queries.

# Segment Tree Structure

The main idea behind segment trees is this:

  • calculate the sum of the entire array and write it down somewhere;
  • split the array into two halves, calculate the sum on both halves, and also write them down somewhere;
  • split these halves into halves, calculate the total of four sums on them, and also write them down;
  • …and so on, until we recursively reach segments of length one.

These computed subsegment sums can be logically represented as a binary tree — which is what we call a segment tree :

Segment trees have some nice properties:

  • If the underlying array has $n$ elements, the segment tree has exactly $(2n - 1)$ nodes — $n$ leaves and $(n - 1)$ internal nodes — because each internal node splits a segment in two, and you only need $(n - 1)$ of them to completely split the original $[0, n-1]$ range.
  • The height of the tree is $\Theta(\log n)$: on each next level starting from the root, the number of nodes roughly doubles and the size of their segments roughly halves.
  • Each segment can be split into $O(\log n)$ non-intersecting segments that correspond to the nodes of the segment tree: you need at most two from each layer.

When $n$ is not a perfect power of two, not all levels are filled entirely — the last layer may be incomplete — but the truthfulness of these properties remains unaffected. The first property allows us to use only $O(n)$ memory to store the tree, and the last two let us solve the problem in $O(\log n)$ time:

  • The add(k, x) query can be handled by adding the value x to all nodes whose segments contain the element k , and we’ve already established that there are only $O(\log n)$ of them.
  • The sum(k) query can be answered by finding all nodes that collectively compose the [0, k) prefix and summing the values stored in them — and we’ve also established that there would be at most $O(\log n)$ of them.

But this is still theory. As we’ll see later, there are remarkably many ways one can implement this data structure.

# Pointer-Based Implementation

The most straightforward way to implement a segment tree is to store everything we need in a node explicitly: including the array segment boundaries, the sum, and the pointers to its children.

If we were at the “Introduction to OOP” class, we would implement a segment tree recursively like this:

If we needed to build it over an existing array, we would rewrite the body of the constructor like this:

The construction time is of no significant interest to us, so to reduce the mental burden, we will just assume that the array is zero-initialized in all future implementations.

Now, to implement add , we need to descend down the tree until we reach a leaf node, adding the delta to the s fields:

To calculate the sum on a segment, we can check if the query covers the current segment fully or doesn’t intersect with it at all — and return the result for this node right away. If neither is the case, we recursively pass the query to the children so that they figure it out themselves:

This function visits a total of $O(\log n)$ nodes because it only spawns children when a segment only partially intersects with the query, and there are at most $O(\log n)$ of such segments.

For prefix sums , these checks can be simplified as the left border of the query is always zero:

Since we have two types of queries, we also got two graphs to look at:

While this object-oriented implementation is quite good in terms of software engineering practices, there are several aspects that make it terrible in terms of performance:

  • Both query implementations use recursion — although the add query can be tail-call optimized.
  • Both query implementations use unpredictable branching , which stalls the CPU pipeline.
  • The nodes store extra metadata. The structure takes $4+4+4+8+8=28$ bytes and gets padded to 32 bytes for memory alignment reasons, while only 4 bytes are really necessary to hold the integer sum.
  • Most importantly, we are doing a lot of pointer chasing : we have to fetch the pointers to the children to descend into them, even though we can infer, ahead of time, which segments we’ll need just from the query.

Pointer chasing outweighs all other issues by orders of magnitude — and to negate it, we need to get rid of pointers, making the structure implicit .

# Implicit Segment Trees

As a segment tree is a type of binary tree, we can use the Eytzinger layout to store its nodes in one large array and use index arithmetic instead of explicit pointers to navigate it.

More formally, we define node $1$ to be the root, holding the sum of the entire array $[0, n)$. Then, for every node $v$ corresponding to the range $[l, r]$, we define:

  • the node $2v$ to be its left child corresponding to the range $[l, \lfloor \frac{l+r}{2} \rfloor)$;
  • the node $(2v+1)$ to be its right child corresponding to the range $[\lfloor \frac{l+r}{2} \rfloor, r)$.

When $n$ is a perfect power of two, this layout packs the entire tree very nicely:

However, when $n$ is not a power of two, the layout stops being compact: although we still have exactly $(2n - 1)$ nodes regardless of how we split segments, they are no longer mapped perfectly to the $[1, 2n)$ range.

For example, consider what happens when we descend to the rightmost leaf in a segment tree of size $17 = 2^4 + 1$:

  • we start with the root numbered $1$ representing the range $[0, 16]$,
  • we go to node $3 = 2 \times 1 + 1$ representing the range $[8, 16]$,
  • we go to node $7 = 2 \times 2 + 1$ representing the range $[12, 16]$,
  • we go to node $15 = 2 \times 7 + 1$ representing the range $[14, 16]$,
  • we go to node $31 = 2 \times 15 + 1$ representing the range $[15, 16]$,
  • and we finally reach node $63 = 2 \times 31 + 1$ representing the range $[16, 16]$.

So, as $63 > 2 \times 17 - 1 = 33$, there are some empty spaces in the layout, but the structure of the tree is still the same, and its height is still $O(\log n)$. For now, we can ignore this problem and just allocate a larger array for storing the nodes — it can be shown that the index of the rightmost leaf never exceeds $4n$, so allocating that many cells will always suffice:

Now, to implement add , we create a similar recursive function but using index arithmetic instead of pointers. Since we’ve also stopped storing the borders of the segment in the nodes, we need to re-calculate them and pass them as parameters for each recursive call:

The implementation of the prefix sum query is largely the same:

Passing around five variables in a recursive function seems clumsy, but the performance gains are clearly worth it:

Apart from requiring much less memory, which is good for fitting into the CPU caches, the main advantage of this implementation is that we can now make use of the memory parallelism and fetch the nodes we need in parallel, considerably improving the running time for both queries.

To improve the performance further, we can:

  • manually optimize the index arithmetic (e.g., noticing that we need to multiply v by 2 either way),
  • replace division by two with an explicit binary shift (because compilers aren’t always able to do it themselves ),
  • and, most importantly, get rid of recursion and make the implementation fully iterative.

As add is tail-recursive and has no return value, it is easy turn it into a single while loop:

Doing the same for the sum query is slightly harder as it has two recursive calls. The key trick is to notice that when we make these calls, one of them is guaranteed to terminate immediately as k can only be in one of the halves, so we can simply check this condition before descending the tree:

This doesn’t improve the performance for the update query by a lot (because it was tail-recursive, and the compiler already performed a similar optimization), but the running time on the prefix sum query has roughly halved for all problem sizes:

This implementation still has some problems: we are using up to twice as much memory as necessary, we have costly branching , and we have to maintain and re-compute array bounds on each iteration. To get rid of these problems, we need to change our approach a little bit.

# Bottom-Up Implementation

Let’s change the definition of the implicit segment tree layout. Instead of relying on the parent-to-child relationship, we first forcefully assign all the leaf nodes numbers in the $[n, 2n)$ range, and then recursively define the parent of node $k$ to be equal to node $\lfloor \frac{k}{2} \rfloor$.

This structure is largely the same as before: you can still reach the root (node $1$) by dividing any node number by two, and each node still has at most two children: $2k$ and $(2k + 1)$, as anything else yields a different parent number when floor-divided by two. The advantage we get is that we’ve forced the last layer to be contiguous and start from $n$, so we can use the array of half the size:

When $n$ is a power of two, the structure of the tree is exactly the same as before and when implementing the queries, we can take advantage of this bottom-up approach and start from the $k$-th leaf node (simply indexed $N + k$) and ascend the tree until we reach the root:

To calculate the sum on the $[l, r)$ subsegment, we can maintain pointers to the first and the last element that needs to be added, increase/decrease them respectively when we add a node and stop after they converge to the same node (which would be their least common ancestor):

Surprisingly, both queries work correctly even when $n$ is not a power of two. To understand why, consider a 13-element segment tree:

The first index of the last layer is always a power of two, but when the array size is not a perfect power of two, some prefix of the leaf elements gets wrapped around to the right side of the tree. Magically, this fact does not pose a problem for our implementation:

  • The add query still updates its parent nodes, even though some of them correspond to some prefix and some suffix of the array instead of a contiguous subsegment.
  • The sum query still computes the sum on the correct subsegment, even when l is on that wrapped prefix and logically “to the right” of r because eventually l becomes the last node on a layer and gets incremented, suddenly jumping to the first element of the next layer and proceeding normally after adding just the right nodes on the wrapped-around part of the tree (look at the dimmed nodes in the illustration).

Compared to the top-down approach, we use half the memory and don’t have to maintain query ranges, which results in simpler and consequently faster code:

When running the benchmarks, we use the sum(l, r) procedure for computing a general subsegment sum and just fix l equal to 0 . To achieve higher performance on the prefix sum query, we want to avoid maintaining l and only move the right border like this:

In contrast, this prefix sum implementation doesn’t work unless $n$ is not a power of two — because k could be on that wrapped-around part, and we’d sum almost the entire array instead of a small prefix.

To make it work for arbitrary array sizes, we can permute the leaves so that they are in the left-to-right logical order in the last two layers of the tree. In the example above, this would mean adding $3$ to all leaf indexes and then moving the last three leaves one level higher by subtracting $13$.

In the general case, this can be done using predication in a few cycles like this:

When implementing the queries, all we need to do is to call the leaf function to get the correct leaf index:

The last touch: by replacing the s += t[k--] line with predication , we can make the implementation branchless (except for the last branch — we still need to check the loop condition):

When combined, these optimizations make the prefix sum queries run much faster:

Notice that the bump in the latency for the prefix sum query starts at $2^{19}$ and not at $2^{20}$, the L3 cache boundary. This is because we are still storing $2n$ integers and also fetching the t[k] element regardless of whether we will add it to s or not. We can actually solve both of these problems.

# Fenwick trees

Implicit structures are great: they avoid pointer chasing, allow visiting all the relevant nodes in parallel, and take less space as they don’t store metadata in nodes. Even better than implicit structures are succinct structures: they only require the information-theoretical minimum space to store the structure, using only $O(1)$ additional memory.

To make a segment tree succinct, we need to look at the values stored in the nodes and search for redundancies — the values that can be inferred from others — and remove them. One way to do this is to notice that in every implementation of prefix sum, we’ve never used the sums stored in right children — therefore, for computing prefix sums, such nodes are redundant:

The Fenwick tree (also called binary indexed tree — soon you’ll understand why) is a type of segment tree that uses this consideration and gets rid of all right children, essentially removing every second node in each layer and making the total node count the same as the underlying array.

To store these segment sums compactly, the Fenwick tree ditches the Eytzinger layout: instead, in place of every element $k$ that would be a leaf in the last layer of a segment tree, it stores the sum of its first non-removed ancestor. For example:

  • the element $7$ would hold the sum on the $[0, 7]$ range ($282$),
  • the element $9$ would hold the sum on the $[8, 9]$ range ($-86$),
  • the element $10$ would hold the sum on the $[10, 10]$ range ($-52$, the element itself).

How to compute this range for a given element $k$ (the left boundary, to be more specific: the right boundary is always the element $k$ itself) quicker than simulating the descend down the tree? Turns out, there is a smart bit trick that works when the tree size is a power of two and we use one-based indexing — just remove the least significant bit of the index:

  • the left bound for element $7 + 1 = 8 = 1000_2$ is $0000_2 = 0$,
  • the left bound for element $9 + 1 = 10 = 1010_2$ is $1000_2 = 8$,
  • the left bound for element $10 + 1 = 11 = 1011_2$ is $1010_2 = 10$.

And to get the last set bit of an integer, we can use this procedure:

This trick works by the virtue of how signed numbers are stored in binary using two’s complement . When we compute -x , we implicitly subtract it from a large power of two: some prefix of the number flips, some suffix of zeros at the end remains, and the only one-bit that stays unchanged is the last set bit — which will be the only one surviving x & -x . For example:

We’ve established what a Fenwick tree is just an array of size n where each element k is defined to be the sum of elements from k - lowbit(k) + 1 and k inclusive in the original array, and now it’s time to implement some queries.

Implementing the prefix sum query is easy. The t[k] holds the sum we need except for the first k - lowbit(k) elements, so we can just add it to the result and then jump to k - lowbit(k) and continue doing this until we reach the beginning of the array:

Since we are repeatedly removing the lowest set bit from k , and also since this procedure is equivalent to visiting the same left-child nodes in a segment tree, each sum query can touch at most $O(\log n)$ nodes:

To slightly improve the performance of the sum query, we use k &= k - 1 to remove the lowest bit in one go, which is one instruction faster than k -= k & -k :

Unlike all previous segment tree implementations, a Fenwick tree is a structure where it is easier and more efficient to calculate the sum on a subsegment as the difference of two prefix sums:

The update query is easier to code but less intuitive. We need to add a value x to all nodes that are left-child ancestors of leaf k . Such nodes have indices m larger than k but m - lowbit(m) < k so that k is included in their ranges.

All such indices need to have a common prefix with k , then a 1 where it was 0 in k , and then a suffix of zeros so that that 1 canceled and the result of m - lowbit(m) is less than k . All such indices can be generated iteratively like this:

Repeatedly adding the lowest set bit to k makes it “more even” and lifts it to its next left-child segment tree ancestor:

Now, if we leave all the code as it is, it works correctly even when $n$ is not a power of two. In this case, the Fenwick tree is not equivalent to a segment tree of size $n$ but to a forest of up to $O(\log n)$ segment trees of power-of-two sizes — or to a single segment tree padded with zeros to a large power of two, if you like to think this way. In either case, all procedures still work correctly as they never touch anything outside the $[1, n]$ range.

The performance of the Fenwick tree is similar to the optimized bottom-up segment tree for the update queries and slightly faster for the prefix sum queries:

There is one weird thing on the graph. After we cross the L3 cache boundary, the performance takes off very rapidly. This is a cache associativity effect: the most frequently used cells all have their indices divisible by large powers of two, so they get aliased to the same cache set, kicking each other out and effectively reducing the cache size.

One way to negate this effect is to insert “holes” in the layout like this:

Computing the hole function is not on the critical path between iterations, so it does not introduce any significant overhead but completely removes the cache associativity problem and shrinks the latency by up to 3x on large arrays:

Fenwick trees are fast, but there are still other minor issues with them. Similar to binary search , the temporal locality of their memory accesses is not the greatest, as rarely accessed elements are grouped with the most frequently accessed ones. Fenwick trees also execute a non-constant number of iterations and have to perform end-of-loop checks, very likely causing a branch misprediction — although just a single one.

There are probably still some things to optimize, but we are going to leave it there and focus on an entirely different approach, and if you know S-trees , you probably already know where this is headed.

# Wide Segment Trees

Here is the main idea: if the memory system is fetching a full cache line for us anyway, let’s fill it to the maximum with information that lets us process the query quicker. For segment trees, this means storing more than one data point in a node. This lets us reduce the tree height and perform fewer iterations when descending or ascending it:

We will use the term wide (B-ary) segment tree to refer to this modification.

To implement this layout, we can use a similar constexpr -based approach we used in S+ trees :

This way, we effectively reduce the height of the tree by approximately $\frac{\log_B n}{\log_2 n} = \log_2 B$ times ($\sim4$ times if $B = 16$), but it becomes non-trivial to implement in-node operations efficiently. For our problem, we have two main options:

  • We could store $B$ sums in each node (for each of its $B$ children).
  • We could store $B$ prefix sums in each node (the $i$-th being the sum of the first $(i + 1)$ children).

If we go with the first option, the add query would be largely the same as in the bottom-up segment tree, but the sum query would need to add up to $B$ scalars in each node it visits. And if we go with the second option, the sum query would be trivial, but the add query would need to add x to some suffix on each node it visits.

In either case, one operation would perform $O(\log_B n)$ operations, touching just one scalar in each node, while the other would perform $O(B \cdot \log_B n)$ operations, touching up to $B$ scalars in each node. We can, however, use SIMD to accelerate the slower operation, and since there are no fast horizontal reductions in SIMD instruction sets, but it is easy to add a vector to a vector, we will choose the second approach and store prefix sums in each node.

This makes the sum query extremely fast and easy to implement:

The add query is more complicated and slower. We need to add a number only to a suffix of a node, and we can do this by masking out the positions that should not be modified.

We can pre-calculate a $B \times B$ array corresponding to $B$ such masks that tell, for each of $B$ positions within a node, whether a certain prefix sum value needs to be updated or not:

Apart from this masking trick, the rest of the computation is simple enough to be handled with GCC vector types only. When processing the add query, we just use these masks to bitwise-and them with the broadcasted x value to mask it and then add it to the values stored in the node:

This speeds up the sum query by more than 10x and the add query by up to 4x compared to the Fenwick tree:

Unlike S-trees , the block size can be easily changed in this implementation (by literally changing one character). Expectedly, when we increase it, the update time also increases as we need to fetch more cache lines and process them, but the sum query time decreases as the height of the tree becomes smaller:

Similar to the S+ trees , the optimal memory layout probably has non-uniform block sizes, depending on the problem size and the distribution of queries, but we are not going to explore this idea and just leave the optimization here.

# Comparisons

Wide segment trees are significantly faster compared to other popular segment tree implementations:

The relative speedup is in the orders of magnitude:

Compared to the original pointer-based implementation, the wide segment tree is up to 200 and 40 times faster for the prefix sum and update queries, respectively — although, for sufficiently large arrays, both implementations become purely memory-bound, and this speedup goes down to around 60 and 15 respectively.

# Modifications

We have only focused on the prefix sum problem for 32-bit integers — to make this already long article slightly less long and also to make the comparison with the Fenwick tree fair — but wide segment trees can be used for other common range operations, although implementing them efficiently with SIMD requires some creativity.

Disclaimer: I haven’t implemented any of these ideas, so some of them may be fatally flawed.

Other data types can be trivially supported by changing the vector type and, if they differ in size, the node size $B$ — which also changes the tree height and hence the total number of iterations for both queries.

It may also be that the queries have different limits on the updates and the prefix sum queries. For example, it is not uncommon to have only “$\pm 1$” update queries with a guarantee that the result of the prefix sum query always fits into a 32-bit integer. If the result could fit into 8 bits, we’d simply use a 8-bit char with block size of $B=64$ bytes, making the total tree height $\frac{\log_{16} n}{\log_{64} n} = \log_{16} 64 = 1.5$ times smaller and both queries proportionally faster.

Unfortunately, that doesn’t work in the general case, but we still have a way to speed up queries when the update deltas are small: we can buffer the updates queries. Using the same “$\pm 1$” example, we can make the branching factor $B=64$ as we wanted, and in each node, we store $B$ 32-bit integers, $B$ 8-bit signed chars, and a single 8-bit counter variable that starts at $127$ and decrements each time we update a node. Then, when we process the queries in nodes:

  • For the update query, we add a vector of masked 8-bit plus-or-minus ones to the char array, decrement the counter, and, if it is zero, convert the values in the char array to 32-bit integers, add them to the integer array, set the char array to zero, and reset the counter back to 127.
  • For the prefix sum query, we visit the same nodes but add both int and char values to the result.

This update accumulation trick lets us increase the performance by up to 1.5x at the cost of using ~25% more memory.

Having a conditional branch in the add query and adding the char array to the int array is rather slow, but since we only have to do it every 127 iterations, it doesn’t cost us anything in the amortized sense. The processing time for the sum query increases, but not significantly — because it mostly depends on the slowest read rather than the number of iterations.

General range queries can be supported the same way as in the Fenwick tree: just decompose the range $[l, r)$ as the difference of two prefix sums $[0, r)$ and $[0, l)$.

This also works for some operations other than addition (multiplication modulo prime, xor, etc.), although they have to be reversible: there should be a way to quickly “cancel” the operation on the left prefix from the final result.

Non-reversible operations can also be supported, although they should still satisfy some other properties:

  • They must be associative: $(a \circ b) \circ c = a \circ (b \circ c)$.
  • They must have an identity element: $a \circ e = e \circ a = a$.

(Such algebraic structures are called monoids if you’re a snob.)

Unfortunately, the prefix sum trick doesn’t work when the operation is not reversible, so we have to switch to option one and store the results of these operations separately for each segment. This requires some significant changes to the queries:

  • The update query should replace one scalar at the leaf, perform a horizontal reduction at the leaf node, and then continue upwards, replacing one scalar of its parent and so on.
  • The range reduction query should, separately for left and right borders, calculate a vector with vertically reduced values on their paths, combine these two vectors into one, and then reduce it horizontally to return the final answer. Note that we still need to use masking to replace values outside of query with neutral elements, and this time, it probably requires some conditional moves/blending and either $B \times B$ precomputed masks or using two masks to account for both left and right borders of the query.

This makes both queries much slower — especially the reduction — but this should still be faster compared to the bottom-up segment tree.

Minimum is a nice exception where the update query can be made slightly faster if the new value of the element is less than the current one: we can skip the horizontal reduction part and just update $\log_B n$ nodes using a scalar procedure.

This works very fast when we mostly have such updates, which is the case, e.g., for the sparse-graph Dijkstra algorithm when we have more edges than vertices. For this problem, the wide segment tree can serve as an efficient fixed-universe min-heap.

Lazy propagation can be done by storing a separate array for the delayed operations in a node. To propagate the updates, we need to go top to bottom (which can be done by simply reversing the direction of the for loop and using k >> (h * b) to calculate the h -th ancestor), broadcast and reset the delayed operation value stored in the parent of the current node, and apply it to all values stored in the current node with SIMD.

One minor problem is that for some operations, we need to know the lengths of the segments: for example, when we need to support a sum and a mass assignment. It can be solved by either padding the elements so that each segment on a layer is uniform in size, pre-calculating the segment lengths and storing them in the node, or using predication to check for the problematic nodes (there will be at most one on each layer).

# Acknowledgements

Many thanks to Giulio Ermanno Pibiri for collaborating on this case study, which is largely based on his 2020 paper “ Practical Trade-Offs for the Prefix-Sum Problem ” co-authored with Rossano Venturini. I highly recommend reading the original article if you are interested in the details we’ve skipped through here for brevity.

The code and some ideas regarding bottom-up segment trees were adapted from a 2015 blog post “ Efficient and easy segment trees ” by Oleksandr Bacherikov.

Segment trees are rarely mentioned in the theoretical computer science literature because they are relatively novel (invented ~2000), mostly don’t do anything that any other binary tree can’t do, and asymptotically aren’t faster — although, in practice, they often win by a lot in terms of speed.  ↩︎

10 Real World Data Science Case Studies Projects with Example

Top 10 Data Science Case Studies Projects with Examples and Solutions in Python to inspire your data science learning in 2023.

10 Real World Data Science Case Studies Projects with Example

BelData science has been a trending buzzword in recent times. With wide applications in various sectors like healthcare , education, retail, transportation, media, and banking -data science applications are at the core of pretty much every industry out there. The possibilities are endless: analysis of frauds in the finance sector or the personalization of recommendations on eCommerce businesses.  We have developed ten exciting data science case studies to explain how data science is leveraged across various industries to make smarter decisions and develop innovative personalized products tailored to specific customers.

data_science_project

Walmart Sales Forecasting Data Science Project

Downloadable solution code | Explanatory videos | Tech Support

Table of Contents

Data science case studies in retail , data science case study examples in entertainment industry , data analytics case study examples in travel industry , case studies for data analytics in social media , real world data science projects in healthcare, data analytics case studies in oil and gas, what is a case study in data science, how do you prepare a data science case study, 10 most interesting data science case studies with examples.

data science case studies

So, without much ado, let's get started with data science business case studies !

With humble beginnings as a simple discount retailer, today, Walmart operates in 10,500 stores and clubs in 24 countries and eCommerce websites, employing around 2.2 million people around the globe. For the fiscal year ended January 31, 2021, Walmart's total revenue was $559 billion showing a growth of $35 billion with the expansion of the eCommerce sector. Walmart is a data-driven company that works on the principle of 'Everyday low cost' for its consumers. To achieve this goal, they heavily depend on the advances of their data science and analytics department for research and development, also known as Walmart Labs. Walmart is home to the world's largest private cloud, which can manage 2.5 petabytes of data every hour! To analyze this humongous amount of data, Walmart has created 'Data Café,' a state-of-the-art analytics hub located within its Bentonville, Arkansas headquarters. The Walmart Labs team heavily invests in building and managing technologies like cloud, data, DevOps , infrastructure, and security.

ProjectPro Free Projects on Big Data and Data Science

Walmart is experiencing massive digital growth as the world's largest retailer . Walmart has been leveraging Big data and advances in data science to build solutions to enhance, optimize and customize the shopping experience and serve their customers in a better way. At Walmart Labs, data scientists are focused on creating data-driven solutions that power the efficiency and effectiveness of complex supply chain management processes. Here are some of the applications of data science  at Walmart:

i) Personalized Customer Shopping Experience

Walmart analyses customer preferences and shopping patterns to optimize the stocking and displaying of merchandise in their stores. Analysis of Big data also helps them understand new item sales, make decisions on discontinuing products, and the performance of brands.

ii) Order Sourcing and On-Time Delivery Promise

Millions of customers view items on Walmart.com, and Walmart provides each customer a real-time estimated delivery date for the items purchased. Walmart runs a backend algorithm that estimates this based on the distance between the customer and the fulfillment center, inventory levels, and shipping methods available. The supply chain management system determines the optimum fulfillment center based on distance and inventory levels for every order. It also has to decide on the shipping method to minimize transportation costs while meeting the promised delivery date.

Here's what valued users are saying about ProjectPro

user profile

Tech Leader | Stanford / Yale University

user profile

Ameeruddin Mohammed

ETL (Abintio) developer at IBM

Not sure what you are looking for?

iii) Packing Optimization 

Also known as Box recommendation is a daily occurrence in the shipping of items in retail and eCommerce business. When items of an order or multiple orders for the same customer are ready for packing, Walmart has developed a recommender system that picks the best-sized box which holds all the ordered items with the least in-box space wastage within a fixed amount of time. This Bin Packing problem is a classic NP-Hard problem familiar to data scientists .

Whenever items of an order or multiple orders placed by the same customer are picked from the shelf and are ready for packing, the box recommendation system determines the best-sized box to hold all the ordered items with a minimum of in-box space wasted. This problem is known as the Bin Packing Problem, another classic NP-Hard problem familiar to data scientists.

Here is a link to a sales prediction data science case study to help you understand the applications of Data Science in the real world. Walmart Sales Forecasting Project uses historical sales data for 45 Walmart stores located in different regions. Each store contains many departments, and you must build a model to project the sales for each department in each store. This data science case study aims to create a predictive model to predict the sales of each product. You can also try your hands-on Inventory Demand Forecasting Data Science Project to develop a machine learning model to forecast inventory demand accurately based on historical sales data.

Get Closer To Your Dream of Becoming a Data Scientist with 70+ Solved End-to-End ML Projects

Amazon is an American multinational technology-based company based in Seattle, USA. It started as an online bookseller, but today it focuses on eCommerce, cloud computing , digital streaming, and artificial intelligence . It hosts an estimate of 1,000,000,000 gigabytes of data across more than 1,400,000 servers. Through its constant innovation in data science and big data Amazon is always ahead in understanding its customers. Here are a few data analytics case study examples at Amazon:

i) Recommendation Systems

Data science models help amazon understand the customers' needs and recommend them to them before the customer searches for a product; this model uses collaborative filtering. Amazon uses 152 million customer purchases data to help users to decide on products to be purchased. The company generates 35% of its annual sales using the Recommendation based systems (RBS) method.

Here is a Recommender System Project to help you build a recommendation system using collaborative filtering. 

ii) Retail Price Optimization

Amazon product prices are optimized based on a predictive model that determines the best price so that the users do not refuse to buy it based on price. The model carefully determines the optimal prices considering the customers' likelihood of purchasing the product and thinks the price will affect the customers' future buying patterns. Price for a product is determined according to your activity on the website, competitors' pricing, product availability, item preferences, order history, expected profit margin, and other factors.

Check Out this Retail Price Optimization Project to build a Dynamic Pricing Model.

iii) Fraud Detection

Being a significant eCommerce business, Amazon remains at high risk of retail fraud. As a preemptive measure, the company collects historical and real-time data for every order. It uses Machine learning algorithms to find transactions with a higher probability of being fraudulent. This proactive measure has helped the company restrict clients with an excessive number of returns of products.

You can look at this Credit Card Fraud Detection Project to implement a fraud detection model to classify fraudulent credit card transactions.

New Projects

Let us explore data analytics case study examples in the entertainment indusry.

Ace Your Next Job Interview with Mock Interviews from Experts to Improve Your Skills and Boost Confidence!

Data Science Interview Preparation

Netflix started as a DVD rental service in 1997 and then has expanded into the streaming business. Headquartered in Los Gatos, California, Netflix is the largest content streaming company in the world. Currently, Netflix has over 208 million paid subscribers worldwide, and with thousands of smart devices which are presently streaming supported, Netflix has around 3 billion hours watched every month. The secret to this massive growth and popularity of Netflix is its advanced use of data analytics and recommendation systems to provide personalized and relevant content recommendations to its users. The data is collected over 100 billion events every day. Here are a few examples of data analysis case studies applied at Netflix :

i) Personalized Recommendation System

Netflix uses over 1300 recommendation clusters based on consumer viewing preferences to provide a personalized experience. Some of the data that Netflix collects from its users include Viewing time, platform searches for keywords, Metadata related to content abandonment, such as content pause time, rewind, rewatched. Using this data, Netflix can predict what a viewer is likely to watch and give a personalized watchlist to a user. Some of the algorithms used by the Netflix recommendation system are Personalized video Ranking, Trending now ranker, and the Continue watching now ranker.

ii) Content Development using Data Analytics

Netflix uses data science to analyze the behavior and patterns of its user to recognize themes and categories that the masses prefer to watch. This data is used to produce shows like The umbrella academy, and Orange Is the New Black, and the Queen's Gambit. These shows seem like a huge risk but are significantly based on data analytics using parameters, which assured Netflix that they would succeed with its audience. Data analytics is helping Netflix come up with content that their viewers want to watch even before they know they want to watch it.

iii) Marketing Analytics for Campaigns

Netflix uses data analytics to find the right time to launch shows and ad campaigns to have maximum impact on the target audience. Marketing analytics helps come up with different trailers and thumbnails for other groups of viewers. For example, the House of Cards Season 5 trailer with a giant American flag was launched during the American presidential elections, as it would resonate well with the audience.

Here is a Customer Segmentation Project using association rule mining to understand the primary grouping of customers based on various parameters.

Get FREE Access to Machine Learning Example Codes for Data Cleaning , Data Munging, and Data Visualization

In a world where Purchasing music is a thing of the past and streaming music is a current trend, Spotify has emerged as one of the most popular streaming platforms. With 320 million monthly users, around 4 billion playlists, and approximately 2 million podcasts, Spotify leads the pack among well-known streaming platforms like Apple Music, Wynk, Songza, amazon music, etc. The success of Spotify has mainly depended on data analytics. By analyzing massive volumes of listener data, Spotify provides real-time and personalized services to its listeners. Most of Spotify's revenue comes from paid premium subscriptions. Here are some of the examples of case study on data analytics used by Spotify to provide enhanced services to its listeners:

i) Personalization of Content using Recommendation Systems

Spotify uses Bart or Bayesian Additive Regression Trees to generate music recommendations to its listeners in real-time. Bart ignores any song a user listens to for less than 30 seconds. The model is retrained every day to provide updated recommendations. A new Patent granted to Spotify for an AI application is used to identify a user's musical tastes based on audio signals, gender, age, accent to make better music recommendations.

Spotify creates daily playlists for its listeners, based on the taste profiles called 'Daily Mixes,' which have songs the user has added to their playlists or created by the artists that the user has included in their playlists. It also includes new artists and songs that the user might be unfamiliar with but might improve the playlist. Similar to it is the weekly 'Release Radar' playlists that have newly released artists' songs that the listener follows or has liked before.

ii) Targetted marketing through Customer Segmentation

With user data for enhancing personalized song recommendations, Spotify uses this massive dataset for targeted ad campaigns and personalized service recommendations for its users. Spotify uses ML models to analyze the listener's behavior and group them based on music preferences, age, gender, ethnicity, etc. These insights help them create ad campaigns for a specific target audience. One of their well-known ad campaigns was the meme-inspired ads for potential target customers, which was a huge success globally.

iii) CNN's for Classification of Songs and Audio Tracks

Spotify builds audio models to evaluate the songs and tracks, which helps develop better playlists and recommendations for its users. These allow Spotify to filter new tracks based on their lyrics and rhythms and recommend them to users like similar tracks ( collaborative filtering). Spotify also uses NLP ( Natural language processing) to scan articles and blogs to analyze the words used to describe songs and artists. These analytical insights can help group and identify similar artists and songs and leverage them to build playlists.

Here is a Music Recommender System Project for you to start learning. We have listed another music recommendations dataset for you to use for your projects: Dataset1 . You can use this dataset of Spotify metadata to classify songs based on artists, mood, liveliness. Plot histograms, heatmaps to get a better understanding of the dataset. Use classification algorithms like logistic regression, SVM, and Principal component analysis to generate valuable insights from the dataset.

Explore Categories

Below you will find case studies for data analytics in the travel and tourism industry.

Airbnb was born in 2007 in San Francisco and has since grown to 4 million Hosts and 5.6 million listings worldwide who have welcomed more than 1 billion guest arrivals in almost every country across the globe. Airbnb is active in every country on the planet except for Iran, Sudan, Syria, and North Korea. That is around 97.95% of the world. Using data as a voice of their customers, Airbnb uses the large volume of customer reviews, host inputs to understand trends across communities, rate user experiences, and uses these analytics to make informed decisions to build a better business model. The data scientists at Airbnb are developing exciting new solutions to boost the business and find the best mapping for its customers and hosts. Airbnb data servers serve approximately 10 million requests a day and process around one million search queries. Data is the voice of customers at AirBnB and offers personalized services by creating a perfect match between the guests and hosts for a supreme customer experience. 

i) Recommendation Systems and Search Ranking Algorithms

Airbnb helps people find 'local experiences' in a place with the help of search algorithms that make searches and listings precise. Airbnb uses a 'listing quality score' to find homes based on the proximity to the searched location and uses previous guest reviews. Airbnb uses deep neural networks to build models that take the guest's earlier stays into account and area information to find a perfect match. The search algorithms are optimized based on guest and host preferences, rankings, pricing, and availability to understand users’ needs and provide the best match possible.

ii) Natural Language Processing for Review Analysis

Airbnb characterizes data as the voice of its customers. The customer and host reviews give a direct insight into the experience. The star ratings alone cannot be an excellent way to understand it quantitatively. Hence Airbnb uses natural language processing to understand reviews and the sentiments behind them. The NLP models are developed using Convolutional neural networks .

Practice this Sentiment Analysis Project for analyzing product reviews to understand the basic concepts of natural language processing.

iii) Smart Pricing using Predictive Analytics

The Airbnb hosts community uses the service as a supplementary income. The vacation homes and guest houses rented to customers provide for rising local community earnings as Airbnb guests stay 2.4 times longer and spend approximately 2.3 times the money compared to a hotel guest. The profits are a significant positive impact on the local neighborhood community. Airbnb uses predictive analytics to predict the prices of the listings and help the hosts set a competitive and optimal price. The overall profitability of the Airbnb host depends on factors like the time invested by the host and responsiveness to changing demands for different seasons. The factors that impact the real-time smart pricing are the location of the listing, proximity to transport options, season, and amenities available in the neighborhood of the listing.

Here is a Price Prediction Project to help you understand the concept of predictive analysis which is widely common in case studies for data analytics. 

Uber is the biggest global taxi service provider. As of December 2018, Uber has 91 million monthly active consumers and 3.8 million drivers. Uber completes 14 million trips each day. Uber uses data analytics and big data-driven technologies to optimize their business processes and provide enhanced customer service. The Data Science team at uber has been exploring futuristic technologies to provide better service constantly. Machine learning and data analytics help Uber make data-driven decisions that enable benefits like ride-sharing, dynamic price surges, better customer support, and demand forecasting. Here are some of the real world data science projects used by uber:

i) Dynamic Pricing for Price Surges and Demand Forecasting

Uber prices change at peak hours based on demand. Uber uses surge pricing to encourage more cab drivers to sign up with the company, to meet the demand from the passengers. When the prices increase, the driver and the passenger are both informed about the surge in price. Uber uses a predictive model for price surging called the 'Geosurge' ( patented). It is based on the demand for the ride and the location.

ii) One-Click Chat

Uber has developed a Machine learning and natural language processing solution called one-click chat or OCC for coordination between drivers and users. This feature anticipates responses for commonly asked questions, making it easy for the drivers to respond to customer messages. Drivers can reply with the clock of just one button. One-Click chat is developed on Uber's machine learning platform Michelangelo to perform NLP on rider chat messages and generate appropriate responses to them.

iii) Customer Retention

Failure to meet the customer demand for cabs could lead to users opting for other services. Uber uses machine learning models to bridge this demand-supply gap. By using prediction models to predict the demand in any location, uber retains its customers. Uber also uses a tier-based reward system, which segments customers into different levels based on usage. The higher level the user achieves, the better are the perks. Uber also provides personalized destination suggestions based on the history of the user and their frequently traveled destinations.

You can take a look at this Python Chatbot Project and build a simple chatbot application to understand better the techniques used for natural language processing. You can also practice the working of a demand forecasting model with this project using time series analysis. You can look at this project which uses time series forecasting and clustering on a dataset containing geospatial data for forecasting customer demand for ola rides.

Explore More  Data Science and Machine Learning Projects for Practice. Fast-Track Your Career Transition with ProjectPro

7) LinkedIn 

LinkedIn is the largest professional social networking site with nearly 800 million members in more than 200 countries worldwide. Almost 40% of the users access LinkedIn daily, clocking around 1 billion interactions per month. The data science team at LinkedIn works with this massive pool of data to generate insights to build strategies, apply algorithms and statistical inferences to optimize engineering solutions, and help the company achieve its goals. Here are some of the real world data science projects at LinkedIn:

i) LinkedIn Recruiter Implement Search Algorithms and Recommendation Systems

LinkedIn Recruiter helps recruiters build and manage a talent pool to optimize the chances of hiring candidates successfully. This sophisticated product works on search and recommendation engines. The LinkedIn recruiter handles complex queries and filters on a constantly growing large dataset. The results delivered have to be relevant and specific. The initial search model was based on linear regression but was eventually upgraded to Gradient Boosted decision trees to include non-linear correlations in the dataset. In addition to these models, the LinkedIn recruiter also uses the Generalized Linear Mix model to improve the results of prediction problems to give personalized results.

ii) Recommendation Systems Personalized for News Feed

The LinkedIn news feed is the heart and soul of the professional community. A member's newsfeed is a place to discover conversations among connections, career news, posts, suggestions, photos, and videos. Every time a member visits LinkedIn, machine learning algorithms identify the best exchanges to be displayed on the feed by sorting through posts and ranking the most relevant results on top. The algorithms help LinkedIn understand member preferences and help provide personalized news feeds. The algorithms used include logistic regression, gradient boosted decision trees and neural networks for recommendation systems.

iii) CNN's to Detect Inappropriate Content

To provide a professional space where people can trust and express themselves professionally in a safe community has been a critical goal at LinkedIn. LinkedIn has heavily invested in building solutions to detect fake accounts and abusive behavior on their platform. Any form of spam, harassment, inappropriate content is immediately flagged and taken down. These can range from profanity to advertisements for illegal services. LinkedIn uses a Convolutional neural networks based machine learning model. This classifier trains on a training dataset containing accounts labeled as either "inappropriate" or "appropriate." The inappropriate list consists of accounts having content from "blocklisted" phrases or words and a small portion of manually reviewed accounts reported by the user community.

Here is a Text Classification Project to help you understand NLP basics for text classification. You can find a news recommendation system dataset to help you build a personalized news recommender system. You can also use this dataset to build a classifier using logistic regression, Naive Bayes, or Neural networks to classify toxic comments.

Get confident to build end-to-end projects

Access to a curated library of 250+ end-to-end industry projects with solution code, videos and tech support.

Pfizer is a multinational pharmaceutical company headquartered in New York, USA. One of the largest pharmaceutical companies globally known for developing a wide range of medicines and vaccines in disciplines like immunology, oncology, cardiology, and neurology. Pfizer became a household name in 2010 when it was the first to have a COVID-19 vaccine with FDA. In early November 2021, The CDC has approved the Pfizer vaccine for kids aged 5 to 11. Pfizer has been using machine learning and artificial intelligence to develop drugs and streamline trials, which played a massive role in developing and deploying the COVID-19 vaccine. Here are a few data analytics case studies by Pfizer :

i) Identifying Patients for Clinical Trials

Artificial intelligence and machine learning are used to streamline and optimize clinical trials to increase their efficiency. Natural language processing and exploratory data analysis of patient records can help identify suitable patients for clinical trials. These can help identify patients with distinct symptoms. These can help examine interactions of potential trial members' specific biomarkers, predict drug interactions and side effects which can help avoid complications. Pfizer's AI implementation helped rapidly identify signals within the noise of millions of data points across their 44,000-candidate COVID-19 clinical trial.

ii) Supply Chain and Manufacturing

Data science and machine learning techniques help pharmaceutical companies better forecast demand for vaccines and drugs and distribute them efficiently. Machine learning models can help identify efficient supply systems by automating and optimizing the production steps. These will help supply drugs customized to small pools of patients in specific gene pools. Pfizer uses Machine learning to predict the maintenance cost of equipment used. Predictive maintenance using AI is the next big step for Pharmaceutical companies to reduce costs.

iii) Drug Development

Computer simulations of proteins, and tests of their interactions, and yield analysis help researchers develop and test drugs more efficiently. In 2016 Watson Health and Pfizer announced a collaboration to utilize IBM Watson for Drug Discovery to help accelerate Pfizer's research in immuno-oncology, an approach to cancer treatment that uses the body's immune system to help fight cancer. Deep learning models have been used recently for bioactivity and synthesis prediction for drugs and vaccines in addition to molecular design. Deep learning has been a revolutionary technique for drug discovery as it factors everything from new applications of medications to possible toxic reactions which can save millions in drug trials.

You can create a Machine learning model to predict molecular activity to help design medicine using this dataset . You may build a CNN or a Deep neural network for this data analyst case study project.

Access Data Science and Machine Learning Project Code Examples

9) Shell Data Analyst Case Study Project

Shell is a global group of energy and petrochemical companies with over 80,000 employees in around 70 countries. Shell uses advanced technologies and innovations to help build a sustainable energy future. Shell is going through a significant transition as the world needs more and cleaner energy solutions to be a clean energy company by 2050. It requires substantial changes in the way in which energy is used. Digital technologies, including AI and Machine Learning, play an essential role in this transformation. These include efficient exploration and energy production, more reliable manufacturing, more nimble trading, and a personalized customer experience. Using AI in various phases of the organization will help achieve this goal and stay competitive in the market. Here are a few data analytics case studies in the petrochemical industry:

i) Precision Drilling

Shell is involved in the processing mining oil and gas supply, ranging from mining hydrocarbons to refining the fuel to retailing them to customers. Recently Shell has included reinforcement learning to control the drilling equipment used in mining. Reinforcement learning works on a reward-based system based on the outcome of the AI model. The algorithm is designed to guide the drills as they move through the surface, based on the historical data from drilling records. It includes information such as the size of drill bits, temperatures, pressures, and knowledge of the seismic activity. This model helps the human operator understand the environment better, leading to better and faster results will minor damage to machinery used. 

ii) Efficient Charging Terminals

Due to climate changes, governments have encouraged people to switch to electric vehicles to reduce carbon dioxide emissions. However, the lack of public charging terminals has deterred people from switching to electric cars. Shell uses AI to monitor and predict the demand for terminals to provide efficient supply. Multiple vehicles charging from a single terminal may create a considerable grid load, and predictions on demand can help make this process more efficient.

iii) Monitoring Service and Charging Stations

Another Shell initiative trialed in Thailand and Singapore is the use of computer vision cameras, which can think and understand to watch out for potentially hazardous activities like lighting cigarettes in the vicinity of the pumps while refueling. The model is built to process the content of the captured images and label and classify it. The algorithm can then alert the staff and hence reduce the risk of fires. You can further train the model to detect rash driving or thefts in the future.

Here is a project to help you understand multiclass image classification. You can use the Hourly Energy Consumption Dataset to build an energy consumption prediction model. You can use time series with XGBoost to develop your model.

10) Zomato Case Study on Data Analytics

Zomato was founded in 2010 and is currently one of the most well-known food tech companies. Zomato offers services like restaurant discovery, home delivery, online table reservation, online payments for dining, etc. Zomato partners with restaurants to provide tools to acquire more customers while also providing delivery services and easy procurement of ingredients and kitchen supplies. Currently, Zomato has over 2 lakh restaurant partners and around 1 lakh delivery partners. Zomato has closed over ten crore delivery orders as of date. Zomato uses ML and AI to boost their business growth, with the massive amount of data collected over the years from food orders and user consumption patterns. Here are a few examples of data analyst case study project developed by the data scientists at Zomato:

i) Personalized Recommendation System for Homepage

Zomato uses data analytics to create personalized homepages for its users. Zomato uses data science to provide order personalization, like giving recommendations to the customers for specific cuisines, locations, prices, brands, etc. Restaurant recommendations are made based on a customer's past purchases, browsing history, and what other similar customers in the vicinity are ordering. This personalized recommendation system has led to a 15% improvement in order conversions and click-through rates for Zomato. 

You can use the Restaurant Recommendation Dataset to build a restaurant recommendation system to predict what restaurants customers are most likely to order from, given the customer location, restaurant information, and customer order history.

ii) Analyzing Customer Sentiment

Zomato uses Natural language processing and Machine learning to understand customer sentiments using social media posts and customer reviews. These help the company gauge the inclination of its customer base towards the brand. Deep learning models analyze the sentiments of various brand mentions on social networking sites like Twitter, Instagram, Linked In, and Facebook. These analytics give insights to the company, which helps build the brand and understand the target audience.

iii) Predicting Food Preparation Time (FPT)

Food delivery time is an essential variable in the estimated delivery time of the order placed by the customer using Zomato. The food preparation time depends on numerous factors like the number of dishes ordered, time of the day, footfall in the restaurant, day of the week, etc. Accurate prediction of the food preparation time can help make a better prediction of the Estimated delivery time, which will help delivery partners less likely to breach it. Zomato uses a Bidirectional LSTM-based deep learning model that considers all these features and provides food preparation time for each order in real-time. 

Data scientists are companies' secret weapons when analyzing customer sentiments and behavior and leveraging it to drive conversion, loyalty, and profits. These 10 data science case studies projects with examples and solutions show you how various organizations use data science technologies to succeed and be at the top of their field! To summarize, Data Science has not only accelerated the performance of companies but has also made it possible to manage & sustain their performance with ease.

FAQs on Data Analysis Case Studies

A case study in data science is an in-depth analysis of a real-world problem using data-driven approaches. It involves collecting, cleaning, and analyzing data to extract insights and solve challenges, offering practical insights into how data science techniques can address complex issues across various industries.

To create a data science case study, identify a relevant problem, define objectives, and gather suitable data. Clean and preprocess data, perform exploratory data analysis, and apply appropriate algorithms for analysis. Summarize findings, visualize results, and provide actionable recommendations, showcasing the problem-solving potential of data science techniques.

Access Solved Big Data and Data Science Projects

About the Author

author profile

ProjectPro is the only online platform designed to help professionals gain practical, hands-on experience in big data, data engineering, data science, and machine learning related technologies. Having over 270+ reusable project templates in data science and big data with step-by-step walkthroughs,

arrow link

© 2024

© 2024 Iconiq Inc.

Privacy policy

User policy

Write for ProjectPro

Navigation Menu

Search code, repositories, users, issues, pull requests..., provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

Improve this page

Add a description, image, and links to the case-study topic page so that developers can more easily learn about it.

Curate this topic

Add this topic to your repo

To associate your repository with the case-study topic, visit your repo's landing page and select "manage topics."

data structures case study topics

Data Analytics Case Study Guide 2024

by Sam McKay, CFA | Data Analytics

data structures case study topics

Data analytics case studies reveal how businesses harness data for informed decisions and growth.

For aspiring data professionals, mastering the case study process will enhance your skills and increase your career prospects.

Sales Now On Advertisement

So, how do you approach a case study?

Use these steps to process a data analytics case study:

Understand the Problem: Grasp the core problem or question addressed in the case study.

Collect Relevant Data: Gather data from diverse sources, ensuring accuracy and completeness.

Apply Analytical Techniques: Use appropriate methods aligned with the problem statement.

Visualize Insights: Utilize visual aids to showcase patterns and key findings.

Derive Actionable Insights: Focus on deriving meaningful actions from the analysis.

This article will give you detailed steps to navigate a case study effectively and understand how it works in real-world situations.

By the end of the article, you will be better equipped to approach a data analytics case study, strengthening your analytical prowess and practical application skills.

Let’s dive in!

Data Analytics Case Study Guide

Table of Contents

What is a Data Analytics Case Study?

A data analytics case study is a real or hypothetical scenario where analytics techniques are applied to solve a specific problem or explore a particular question.

It’s a practical approach that uses data analytics methods, assisting in deciphering data for meaningful insights. This structured method helps individuals or organizations make sense of data effectively.

Additionally, it’s a way to learn by doing, where there’s no single right or wrong answer in how you analyze the data.

So, what are the components of a case study?

Key Components of a Data Analytics Case Study

Key Components of a Data Analytics Case Study

A data analytics case study comprises essential elements that structure the analytical journey:

Problem Context: A case study begins with a defined problem or question. It provides the context for the data analysis , setting the stage for exploration and investigation.

Data Collection and Sources: It involves gathering relevant data from various sources , ensuring data accuracy, completeness, and relevance to the problem at hand.

Analysis Techniques: Case studies employ different analytical methods, such as statistical analysis, machine learning algorithms, or visualization tools, to derive meaningful conclusions from the collected data.

Insights and Recommendations: The ultimate goal is to extract actionable insights from the analyzed data, offering recommendations or solutions that address the initial problem or question.

Now that you have a better understanding of what a data analytics case study is, let’s talk about why we need and use them.

Why Case Studies are Integral to Data Analytics

Why Case Studies are Integral to Data Analytics

Case studies serve as invaluable tools in the realm of data analytics, offering multifaceted benefits that bolster an analyst’s proficiency and impact:

Real-Life Insights and Skill Enhancement: Examining case studies provides practical, real-life examples that expand knowledge and refine skills. These examples offer insights into diverse scenarios, aiding in a data analyst’s growth and expertise development.

Validation and Refinement of Analyses: Case studies demonstrate the effectiveness of data-driven decisions across industries, providing validation for analytical approaches. They showcase how organizations benefit from data analytics. Also, this helps in refining one’s own methodologies

Showcasing Data Impact on Business Outcomes: These studies show how data analytics directly affects business results, like increasing revenue, reducing costs, or delivering other measurable advantages. Understanding these impacts helps articulate the value of data analytics to stakeholders and decision-makers.

Learning from Successes and Failures: By exploring a case study, analysts glean insights from others’ successes and failures, acquiring new strategies and best practices. This learning experience facilitates professional growth and the adoption of innovative approaches within their own data analytics work.

Including case studies in a data analyst’s toolkit helps gain more knowledge, improve skills, and understand how data analytics affects different industries.

Using these real-life examples boosts confidence and success, guiding analysts to make better and more impactful decisions in their organizations.

But not all case studies are the same.

Let’s talk about the different types.

Types of Data Analytics Case Studies

 Types of Data Analytics Case Studies

Data analytics encompasses various approaches tailored to different analytical goals:

Exploratory Case Study: These involve delving into new datasets to uncover hidden patterns and relationships, often without a predefined hypothesis. They aim to gain insights and generate hypotheses for further investigation.

Predictive Case Study: These utilize historical data to forecast future trends, behaviors, or outcomes. By applying predictive models, they help anticipate potential scenarios or developments.

Diagnostic Case Study: This type focuses on understanding the root causes or reasons behind specific events or trends observed in the data. It digs deep into the data to provide explanations for occurrences.

Prescriptive Case Study: This case study goes beyond analytics; it provides actionable recommendations or strategies derived from the analyzed data. They guide decision-making processes by suggesting optimal courses of action based on insights gained.

Each type has a specific role in using data to find important insights, helping in decision-making, and solving problems in various situations.

Regardless of the type of case study you encounter, here are some steps to help you process them.

Roadmap to Handling a Data Analysis Case Study

Roadmap to Handling a Data Analysis Case Study

Embarking on a data analytics case study requires a systematic approach, step-by-step, to derive valuable insights effectively.

Here are the steps to help you through the process:

Step 1: Understanding the Case Study Context: Immerse yourself in the intricacies of the case study. Delve into the industry context, understanding its nuances, challenges, and opportunities.

Data Mentor Advertisement

Identify the central problem or question the study aims to address. Clarify the objectives and expected outcomes, ensuring a clear understanding before diving into data analytics.

Step 2: Data Collection and Validation: Gather data from diverse sources relevant to the case study. Prioritize accuracy, completeness, and reliability during data collection. Conduct thorough validation processes to rectify inconsistencies, ensuring high-quality and trustworthy data for subsequent analysis.

Data Collection and Validation in case study

Step 3: Problem Definition and Scope: Define the problem statement precisely. Articulate the objectives and limitations that shape the scope of your analysis. Identify influential variables and constraints, providing a focused framework to guide your exploration.

Step 4: Exploratory Data Analysis (EDA): Leverage exploratory techniques to gain initial insights. Visualize data distributions, patterns, and correlations, fostering a deeper understanding of the dataset. These explorations serve as a foundation for more nuanced analysis.

Step 5: Data Preprocessing and Transformation: Cleanse and preprocess the data to eliminate noise, handle missing values, and ensure consistency. Transform data formats or scales as required, preparing the dataset for further analysis.

Data Preprocessing and Transformation in case study

Step 6: Data Modeling and Method Selection: Select analytical models aligning with the case study’s problem, employing statistical techniques, machine learning algorithms, or tailored predictive models.

In this phase, it’s important to develop data modeling skills. This helps create visuals of complex systems using organized data, which helps solve business problems more effectively.

Understand key data modeling concepts, utilize essential tools like SQL for database interaction, and practice building models from real-world scenarios.

Furthermore, strengthen data cleaning skills for accurate datasets, and stay updated with industry trends to ensure relevance.

Data Modeling and Method Selection in case study

Step 7: Model Evaluation and Refinement: Evaluate the performance of applied models rigorously. Iterate and refine models to enhance accuracy and reliability, ensuring alignment with the objectives and expected outcomes.

Step 8: Deriving Insights and Recommendations: Extract actionable insights from the analyzed data. Develop well-structured recommendations or solutions based on the insights uncovered, addressing the core problem or question effectively.

Step 9: Communicating Results Effectively: Present findings, insights, and recommendations clearly and concisely. Utilize visualizations and storytelling techniques to convey complex information compellingly, ensuring comprehension by stakeholders.

Communicating Results Effectively

Step 10: Reflection and Iteration: Reflect on the entire analysis process and outcomes. Identify potential improvements and lessons learned. Embrace an iterative approach, refining methodologies for continuous enhancement and future analyses.

This step-by-step roadmap provides a structured framework for thorough and effective handling of a data analytics case study.

Now, after handling data analytics comes a crucial step; presenting the case study.

Presenting Your Data Analytics Case Study

Presenting Your Data Analytics Case Study

Presenting a data analytics case study is a vital part of the process. When presenting your case study, clarity and organization are paramount.

To achieve this, follow these key steps:

Structuring Your Case Study: Start by outlining relevant and accurate main points. Ensure these points align with the problem addressed and the methodologies used in your analysis.

Crafting a Narrative with Data: Start with a brief overview of the issue, then explain your method and steps, covering data collection, cleaning, stats, and advanced modeling.

Visual Representation for Clarity: Utilize various visual aids—tables, graphs, and charts—to illustrate patterns, trends, and insights. Ensure these visuals are easy to comprehend and seamlessly support your narrative.

Visual Representation for Clarity

Highlighting Key Information: Use bullet points to emphasize essential information, maintaining clarity and allowing the audience to grasp key takeaways effortlessly. Bold key terms or phrases to draw attention and reinforce important points.

Addressing Audience Queries: Anticipate and be ready to answer audience questions regarding methods, assumptions, and results. Demonstrating a profound understanding of your analysis instills confidence in your work.

Integrity and Confidence in Delivery: Maintain a neutral tone and avoid exaggerated claims about findings. Present your case study with integrity, clarity, and confidence to ensure the audience appreciates and comprehends the significance of your work.

Integrity and Confidence in Delivery

By organizing your presentation well, telling a clear story through your analysis, and using visuals wisely, you can effectively share your data analytics case study.

This method helps people understand better, stay engaged, and draw valuable conclusions from your work.

We hope by now, you are feeling very confident processing a case study. But with any process, there are challenges you may encounter.

EDNA AI Advertisement

Key Challenges in Data Analytics Case Studies

Key Challenges in Data Analytics Case Studies

A data analytics case study can present various hurdles that necessitate strategic approaches for successful navigation:

Challenge 1: Data Quality and Consistency

Challenge: Inconsistent or poor-quality data can impede analysis, leading to erroneous insights and flawed conclusions.

Solution: Implement rigorous data validation processes, ensuring accuracy, completeness, and reliability. Employ data cleansing techniques to rectify inconsistencies and enhance overall data quality.

Challenge 2: Complexity and Scale of Data

Challenge: Managing vast volumes of data with diverse formats and complexities poses analytical challenges.

Solution: Utilize scalable data processing frameworks and tools capable of handling diverse data types. Implement efficient data storage and retrieval systems to manage large-scale datasets effectively.

Challenge 3: Interpretation and Contextual Understanding

Challenge: Interpreting data without contextual understanding or domain expertise can lead to misinterpretations.

Solution: Collaborate with domain experts to contextualize data and derive relevant insights. Invest in understanding the nuances of the industry or domain under analysis to ensure accurate interpretations.

Interpretation and Contextual Understanding

Challenge 4: Privacy and Ethical Concerns

Challenge: Balancing data access for analysis while respecting privacy and ethical boundaries poses a challenge.

Solution: Implement robust data governance frameworks that prioritize data privacy and ethical considerations. Ensure compliance with regulatory standards and ethical guidelines throughout the analysis process.

Challenge 5: Resource Limitations and Time Constraints

Challenge: Limited resources and time constraints hinder comprehensive analysis and exhaustive data exploration.

Solution: Prioritize key objectives and allocate resources efficiently. Employ agile methodologies to iteratively analyze and derive insights, focusing on the most impactful aspects within the given timeframe.

Recognizing these challenges is key; it helps data analysts adopt proactive strategies to mitigate obstacles. This enhances the effectiveness and reliability of insights derived from a data analytics case study.

Now, let’s talk about the best software tools you should use when working with case studies.

Top 5 Software Tools for Case Studies

Top Software Tools for Case Studies

In the realm of case studies within data analytics, leveraging the right software tools is essential.

Here are some top-notch options:

Tableau : Renowned for its data visualization prowess, Tableau transforms raw data into interactive, visually compelling representations, ideal for presenting insights within a case study.

Python and R Libraries: These flexible programming languages provide many tools for handling data, doing statistics, and working with machine learning, meeting various needs in case studies.

Microsoft Excel : A staple tool for data analytics, Excel provides a user-friendly interface for basic analytics, making it useful for initial data exploration in a case study.

SQL Databases : Structured Query Language (SQL) databases assist in managing and querying large datasets, essential for organizing case study data effectively.

Statistical Software (e.g., SPSS , SAS ): Specialized statistical software enables in-depth statistical analysis, aiding in deriving precise insights from case study data.

Choosing the best mix of these tools, tailored to each case study’s needs, greatly boosts analytical abilities and results in data analytics.

Final Thoughts

Case studies in data analytics are helpful guides. They give real-world insights, improve skills, and show how data-driven decisions work.

Using case studies helps analysts learn, be creative, and make essential decisions confidently in their data work.

Check out our latest clip below to further your learning!

Frequently Asked Questions

What are the key steps to analyzing a data analytics case study.

When analyzing a case study, you should follow these steps:

Clarify the problem : Ensure you thoroughly understand the problem statement and the scope of the analysis.

Make assumptions : Define your assumptions to establish a feasible framework for analyzing the case.

Gather context : Acquire relevant information and context to support your analysis.

Analyze the data : Perform calculations, create visualizations, and conduct statistical analysis on the data.

Provide insights : Draw conclusions and develop actionable insights based on your analysis.

How can you effectively interpret results during a data scientist case study job interview?

During your next data science interview, interpret case study results succinctly and clearly. Utilize visual aids and numerical data to bolster your explanations, ensuring comprehension.

Frame the results in an audience-friendly manner, emphasizing relevance. Concentrate on deriving insights and actionable steps from the outcomes.

How do you showcase your data analyst skills in a project?

To demonstrate your skills effectively, consider these essential steps. Begin by selecting a problem that allows you to exhibit your capacity to handle real-world challenges through analysis.

Methodically document each phase, encompassing data cleaning, visualization, statistical analysis, and the interpretation of findings.

Utilize descriptive analysis techniques and effectively communicate your insights using clear visual aids and straightforward language. Ensure your project code is well-structured, with detailed comments and documentation, showcasing your proficiency in handling data in an organized manner.

Lastly, emphasize your expertise in SQL queries, programming languages, and various analytics tools throughout the project. These steps collectively highlight your competence and proficiency as a skilled data analyst, demonstrating your capabilities within the project.

Can you provide an example of a successful data analytics project using key metrics?

A prime illustration is utilizing analytics in healthcare to forecast hospital readmissions. Analysts leverage electronic health records, patient demographics, and clinical data to identify high-risk individuals.

Implementing preventive measures based on these key metrics helps curtail readmission rates, enhancing patient outcomes and cutting healthcare expenses.

This demonstrates how data analytics, driven by metrics, effectively tackles real-world challenges, yielding impactful solutions.

Why would a company invest in data analytics?

Companies invest in data analytics to gain valuable insights, enabling informed decision-making and strategic planning. This investment helps optimize operations, understand customer behavior, and stay competitive in their industry.

Ultimately, leveraging data analytics empowers companies to make smarter, data-driven choices, leading to enhanced efficiency, innovation, and growth.

author avatar

Related Posts

Simple To Use Best Practises For Data Visualization

Simple To Use Best Practises For Data Visualization

Data Analytics

So you’ve got a bunch of data and you want to make it look pretty. Or maybe you’ve heard about this...

Exploring The Benefits Of Geospatial Data Visualization Techniques

Data visualization has come a long way from simple bar charts and line graphs. As the volume and...

4 Types of Data Analytics: Explained

4 Types of Data Analytics: Explained

In a world full of data, data analytics is the heart and soul of an operation. It's what transforms raw...

Data Analytics Outsourcing: Pros and Cons Explained

Data Analytics Outsourcing: Pros and Cons Explained

In today's data-driven world, businesses are constantly swimming in a sea of information, seeking the...

What Does a Data Analyst Do on a Daily Basis?

What Does a Data Analyst Do on a Daily Basis?

In the digital age, data plays a significant role in helping organizations make informed decisions and...

data structures case study topics

NTRS - NASA Technical Reports Server

Available downloads, related records.

IMAGES

  1. PPT

    data structures case study topics

  2. How to Create a Case Study + 14 Case Study Templates

    data structures case study topics

  3. Data Analysis Case Study: Learn From These Winning Data Projects

    data structures case study topics

  4. Case Study

    data structures case study topics

  5. Data Analysis Case Study: Learn From These #Winning Data Projects

    data structures case study topics

  6. 190 Excellent Case Study Topics to Focus On

    data structures case study topics

VIDEO

  1. Data Structures Complete Topics for Engineering Exam

  2. These 5 DSA topics can get you a Job

  3. Data Structures and Algorithms Important Questions Anna University Exam 1st February 2024 CD3291

  4. DATA STRUCTURE AND APPLICATIONS MODULE WISE QUESTION BANK|FIX QUESTIONS|#vtuexams #datastructures

  5. Top 10 SQL Projects || Data Analyst SQL Project || Data Analyst Portfolio Project

  6. TOP 10 IMPORTANT QUESTION OF DATA STRUCTURE

COMMENTS

  1. 13 Interesting Data Structure Projects Ideas and Topics For ...

    Data structures offers a structured way to organize and store data. For example, a stack organizes data in a last-in, first-out (LIFO) fashion, while a queue uses a first-in, first-out (FIFO) approach. These organizations make it easier to model and solve specific problems efficiently. 4. Search and Retrieval.

  2. 13: Case study

    This chapter presents a case study with exercises that let you think about choosing data structures and practice using them. 13.1: Word frequency analysis. 13.2: Random numbers. 13.3: Word histogram. 13.4: Most common words. 13.5: Optional parameters. 13.6: Dictionary subtraction. 13.7: Random words. 13.8: Markov analysis.

  3. Real-life Applications of Data Structures and Algorithms (DSA)

    Application of Algorithms: Algorithms are well-defined sets of instructions designed that are used to solve problems or perform a task. To explain in simpler terms, it is a set of operations performed in a step-by-step manner to execute a task. The real-life applications of algorithms are discussed below.

  4. Data Structures Case Studies

    Data Structures Case Studies. Optimizing data structures is different from optimizing algorithms as data structure problems have more dimensions: you may be optimizing for throughput, for latency, for memory usage, or any combination of those — and this complexity blows up exponentially when you need to process multiple query types and ...

  5. PDF CS166 Handout 09 Spring 2016 April 28, 2016 Suggested Final Project Topics

    Suggested Final Project Topics Here are a list of data structure and families of data structures we think you might find interesting ... If you'd like to study a data structure that arises in a variety of disparate contexts, ... In that case, suffix trees and suffix arrays are still quite fast, but aren't asymptotically optimal. ...

  6. Data Structures Tutorial

    Data structures are essential components that help organize and store data efficiently in computer memory. They provide a way to manage and manipulate data effectively, enabling faster access, insertion, and deletion operations. Common data structures include arrays, linked lists, stacks, queues, trees, and graphs , each serving specific purposes based on the requirements of the problem.

  7. Data Structures

    Module 1 • 4 hours to complete. In this module, you will learn about the basic data structures used throughout the rest of this course. We start this module by looking in detail at the fundamental building blocks: arrays and linked lists. From there, we build up two important data structures: stacks and queues.

  8. Complete Introduction to the 30 Most Essential Data Structures

    6. Graphs. A graph is a non-linear data structure representing a pair of two sets: G= {V, E}, where V is the set of vertices (nodes), and E the set of edges (arrows). Nodes are values interconnected by edges - lines that depict the dependency (sometimes associated with a cost/distance) between two nodes.

  9. The top data structures you should know for your next coding interview

    Arrays. An array is the simplest and most widely used data structure. Other data structures like stacks and queues are derived from arrays. Here's an image of a simple array of size 4, containing elements (1, 2, 3 and 4). Each data element is assigned a positive numerical value called the Index, which corresponds to the position of that item ...

  10. 17. Case Study 4—A Queue Simulation

    Case Study 4—A Queue Simulation 17.1 INTRODUCTION. Chapter 10 introduced the topic of queues including the priority queue, which holds items in the order of some defined criterion. This case study will build an application to simulate such a queue. It also includes the process of writing data to a disk file as described in Chapter 4.

  11. Advanced Data Structures

    Data structures play a central role in modern computer science. You interact with data structures even more often than with algorithms (think Google, your mail server, and even your network routers). In addition, data structures are essential building blocks in obtaining efficient algorithms. This course covers major results and current directions of research in data structure. Acknowledgments ...

  12. Open Data Structures: An Introduction

    Offered as an introduction to the field of data structures and algorithms, Open Data Structures covers the implementation and analysis of data structures for sequences (lists), queues, priority queues, unordered dictionaries, ordered dictionaries, and graphs. Focusing on a mathematically rigorous approach that is fast, practical, and efficient, Morin clearly and briskly presents instruction ...

  13. Essential Topics in Data Structures

    The choice of data structure often decides the efficiency of a program. Therefore, it is crucial to have a thorough understanding of these data structures and how they function. In this article, we will explore some of the most important topics in Data Structure. Arrays; Arrays are the simplest data structure that stores elements of the same type.

  14. Distributed data structures: A case study

    Distributed data structures: A case study Abstract: In spite of the amount of work recently devoted to distributed systems, distributed applications are relatively rare. One hypothesis to explain this scarcity of examples is a lack of experience with algorithm design techniques tailored to an environment in which out-of-date and incomplete ...

  15. I learned all data structures in a week. This is what it did to my

    We call them data structures. Accessing, inserting, deleting, finding, and sorting the data are some of the well-known operations that one can perform using data structures. The first entry in the series ' Array' leaves no need to have multiple data structures. And yet there will be so many more.

  16. 4: Case Study- Data Structure Selection

    The LibreTexts libraries are Powered by NICE CXone Expert and are supported by the Department of Education Open Textbook Pilot Project, the UC Davis Office of the Provost, the UC Davis Library, the California State University Affordable Learning Solutions Program, and Merlot. We also acknowledge previous National Science Foundation support under grant numbers 1246120, 1525057, and 1413739.

  17. Segment Trees

    The lessons learned from optimizing binary search can be applied to a broad range of data structures.. In this article, instead of trying to optimize something from the STL again, we focus on segment trees, the structures that may be unfamiliar to most normal programmers and perhaps even most computer science researchers 1, but that are used very extensively in programming competitions for ...

  18. 10 Real World Data Science Case Studies Projects with Example

    Here are some of the real world data science projects used by uber: i) Dynamic Pricing for Price Surges and Demand Forecasting. Uber prices change at peak hours based on demand. Uber uses surge pricing to encourage more cab drivers to sign up with the company, to meet the demand from the passengers.

  19. (PDF) An overview of data structures and algorithms: case study of us

    PDF | On Jan 15, 2018, D.L. Nkweteyim published An overview of data structures and algorithms: case study of us in the vector-space model and mining off requentitem sets using the apriori ...

  20. PDF Open Case Studies: Statistics and Data Science Education through Real

    However, Background is listed first here to more easily map to our Open Case Studies model. example topics covered in all case studies (TableS1). 1. Motivation. Each case study begins with a motivating data visualization. This idea originated from Dr. Mine C¸ etinkaya-Rundel's talk entitled 'Let Them Eat Cake

  21. Case Studies of Data Structure

    Some of the examples of case studies used for teaching fundamental data structures are tabulated in Table 2. Students acquired the concepts to build data structures like stacks, queues, linked ...

  22. [PDF] High-level synthesis of dynamic data structures: A case study

    A comparative case study using Xilinx Vivado HLS as an exemplary state-of-the-art high-level synthesis tool, which reveals a degradation in latency by a factor greater than 30× and presents code transformations that narrow the performance gap to a factor of four. High-level synthesis promises a significant shortening of the FPGA design cycle when compared with design entry using register ...

  23. case-study · GitHub Topics · GitHub

    This repository contains Jonathan et al.'s AoL (Assurance of Learning) Case Study for COMP6049001 - Algorithm Design and Analysis Course. This case study has been declared to have passed with a high distinction (score: 100, grade: A). c algorithms case-study algorithm-design-and-analysis assurance-of-learning.

  24. Data Analytics Case Study Guide 2024

    A data analytics case study comprises essential elements that structure the analytical journey: Problem Context: A case study begins with a defined problem or question. It provides the context for the data analysis, setting the stage for exploration and investigation.. Data Collection and Sources: It involves gathering relevant data from various sources, ensuring data accuracy, completeness ...

  25. NTRS

    This work is focused on the role of soil moisture in the prediction of tropical cyclones (TCs) approaching land and after landfall. Soil moisture conditions can impact the circulation and structure of an existing tropical cyclone (TC) when part or all of the circulation is over land. For example, dry land surface conditions may lead to faster dissipation of a TC over land (often associated ...