Amazon, Apple, Adobe, Cisco, D.E. Shaw, Google, Intuit, Microsoft…

If you are not a Medium member then you can use below friendly link to read the complete story.

Friendly Link so that everyone can read my article.

Amazon, Apple, Adobe, Cisco, D.E. Shaw, Google, Intuit, Microsoft, Meta, Nutanix, Netflix, Oracle, Qualcomm, Salesforce, Samsung, Uber, Zoom and a long list, they always focus on your ability to use Data Structures and Algorithms to solve any real-world problems. Data Structures and Algorithms are the core elements of any technical or coding interview. So, let's see a few examples of Data Structures in real life.

Examples of Arrays:

  1. Your phone contact list. It's an alphabetically sorted array. You can check out your phone if you haven't seen your contact list 😅.
  2. Movie ticket booking. It's a classic example of a 2D array. When you book a movie ticket, you choose row and column like E6, and this arrangement of row and column is a 2D array.
  3. Image processing. You must have heard about this term. Image processing is performing some operations on an image to get information out of it. In this, the Image Processing System treats all images as a 2D array of pixels.
None
Contact List, Movie Ticket Booking, and 2D array of Pixels.

Let's move to

Examples of Stack:

1. Expression Evaluation. Stack is used to evaluate infix, postfix, and prefix expressions. Operators and operands are pushed onto the stack and operations are performed based on the operator's stack's top elements.

None
Two Stacks to evaluate expression

2. Undo/Redo Operations. Doing undo (ctrl -Z) or redo (ctrl-Y) on your Word document uses stack at the backend. If you are interested in how it is being done using stacks, then you can check out this link. It's a good interview question.

None
Typing in word document and performing undo and redo.

Next is

Examples of Queue:

  1. Printer service. A classic example of a queue. Consider you have 3 pdf files A, B, and C. You give print instructions to the printer for A, then B, and then C. Now, the printer will print PDF files on the order of First Come First Serve.
  2. Request to server. A lot of requests have been made to the server by multiple users. All requests get queued up. The server serves requests on a first come first serve.
  3. Player Sequence. In multiplayer games like LUDO, player Sequence has been maintained using circular queues.
None
Printer, Requests to Server and Ludo

Examples of LinkedList:

Previous/Next in Google Drive, Forward/Backward in Browser, and Playing Next/Previous song in a media player are the classic examples of doubly LinkedList. I will soon publish an article that will talk about the design and implementation of Forward/Backward in Browser using doubly LinkedList. As of now, you can check out the implementation here.

None
Previous/Next in Google Drive, Browser and Spotify

Now we are moving to the favorite data structures of most of the companies. Graph and Trees.

Examples of Graph:

  1. Social Media Apps. Your favorite 😅. Here, every user is represented using a graph node and if that user is a friend of 'X' then the user node is connected to the 'X' node which is represented by an edge of the graph.
  2. Google Maps. Every city or any location represents a graph node, and the routes connecting these cities are represented by the edges of the graph. Just FYI, Google Maps shows the shortest path between two cities by applying the Breadth First Search Algorithm over the graph.
None
Instagram App and Google Map

Examples of Tree:

1. Auto-Suggestion. Auto-Suggestion in the search bar uses a prefix tree which is also called TRIE data structure.

None
Google Search Bar with Auto Suggestions

2. Indexing in DBMS. Databases use tree data structures for indexing. B trees are mostly used. You can read about B trees here.

3. Comments over LinkedIn Post. Comments are the children of a Post. Consider Post as the root node and all comments are the child nodes associated or connected with the Post.

None
LinkedIn Post with Comments

That's it… Hope you liked this article. Please do at least "one clap, one comment, highlight at least one line which you like the most, follow and share." It motivates me.

Check out my other interview-oriented articles here.

None

Connect with me on LinkedIn if you are looking for coding tips, interview preparation, and interview tips.

Thank You!!!