0% found this document useful (0 votes)
654 views

Applications of Data Structures

This document discusses various data structures and their real-world applications. It provides examples of how linked lists can be used to represent polynomials, images, blockchains, and programming languages. It also discusses applications of stacks, queues, trees, graphs, tries, and hashing. Key examples include using stacks for function calls and undo operations, queues for scheduling and ticket lines, trees for file systems and databases, graphs for social networks and maps, and hashing in banks.

Uploaded by

DãvínMâk
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
654 views

Applications of Data Structures

This document discusses various data structures and their real-world applications. It provides examples of how linked lists can be used to represent polynomials, images, blockchains, and programming languages. It also discusses applications of stacks, queues, trees, graphs, tries, and hashing. Key examples include using stacks for function calls and undo operations, queues for scheduling and ticket lines, trees for file systems and databases, graphs for social networks and maps, and hashing in banks.

Uploaded by

DãvínMâk
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Applications of Data Structures

In real life? We do it all the time!

1. On the way to your college canteen? A* search


2. Waiting in line in the canteen? Queue
3. Notice that girl standing in front? Linear search
4. Searching for her dad in the phone book? Binary search
5. Stupid! Google it! Trie
6. Search for her on Facebook! Depth-first search
7. Found her! Friend request? Accepted! Send a Hi! Graph
8. Writing her a secret love letter? Caesar cipher
9. Uploading your first date pic on fb? Image compression algorithms
10. Looking through her Whatsapp messages? KMP algorithm
11. She found out and had your first fight? Start over with some gifts! Backtracking
12. Got her list of items to buy? Array
13. Too many items! Low on cash, maybe? Priority queue
14. Making her play treasure hunt for her gifts? Linked list
15. Wait! Go back! Is that a ring? Stack
16. Girl’s family not agreeing to your proposal? Divide and conquer
17. Got married? Congrats! Going for your honeymoon? Travelling salesman
problem
18. Your mom packing luggage for you? 0/1 Knapsack problem
19. She packed your favorite pickles? Hash table
20. Driving to the airport? Breadth-first search

Linked List:[
 A polynomial can be represented in an array or in a linked list by simply
storing the coefficient and exponent of each term.
 DMA
1. Can be used to implement Stack, Queue’s, Tress, Graphs efficiently. (and
there are plenty of uses of all these)
2. When you want to insert an element in array it needs lot of shifting. But in
linked list its very easy.
3. Image viewer! (next and previous button. the next and previous images are
linked there
4. A blockchain (e.g. bitcoin ) is a linked list data structure.
5. The famous lisp programming language where everything is list. Lisp means list
processing.
6. List form the basis of processing (recursion and pattern matching) in
functional programming (e.g Haskell) e.g. x::xs pattern matches to x as head
of list and xs as rest of list hence giving a nice way to recurse and process.
7. Lift in the Building.

8. Applications of Doubly linked list can be


- A great way to represent a deck of cards in a game.
- The browser cache which allows you to hit the BACK button (a linked list of URLs)
- Applications that have a Most Recently Used (MRU) list (a linked list of file names)
9. Circular linked lists are used in
-Round Robin Scheduling,
-to keep track of the turn in a multi-player game,
-to repeat the songs in a playlist etc.

Stack Applns:-
Real World applications in which order of Object matters stack are used for an example
in following situation Stack is used

Undo

Back Forward

Reverse word

1. During Function Calls because it Follows A LIFO Structure


2. In Evaluating an Expression Stack is Used
3. Converting an Infix to Postfix
4. During Depth First Search (DFS) Stack is used
5. Stack is used in some Scheduling Algorithms
Applications of Queue Data Structure::

BFS

Ticket Counters

1) When a resource is shared among multiple consumers. Examples include CPU


scheduling, Disk Scheduling.
2) When data is transferred asynchronously (data not necessarily received at
same rate as sent) between two processes. Examples include IO Buffers, pipes,
file IO, etc.
 Queue:
o Queueing processes : any device does not have infinite resources, so a queue
has to be used in order to allocate resources to those process that need it on a
priority level.
 Bloom filters in shortening URLs.
 A Bloom filter is a space-efficient probabilistic data structure, conceived by Burton
Howard Bloom in 1970, that is used to test whether an element is a member of a set.
 Graphs:
o GIS : in Geographic Informative Systems, transport and vehicular technology.
o Maps : Google Maps, Bing, etc.
o Paths between points(keys) : Like the A* Algorithm, etc.
 Trees
o Data base designing : creating your own database just to store the data based
upon some key value
o Creating file system : Operating systems maintain a disk's file system as a tree.
o Zoology: Maintaining the structures of the entire animal & plant kingdom.
o Social Networks : Establishing relations between users based on some key.

 B-Trees (Binary Trees):
o E-commerce : while accessing unique keys. B-Trees balanced multi-way search
tree of order N.
o Searching : Searching quickly for a given element.
o B-trees are used to index data in many database systems such as MySQL. The
reason is that B-trees are shallower than most other types of self-balancing trees, so
they lower the number of disk operations required to retrieve data.
 Hash Tables: in Banks for combining two or more accounts for matching
Social Security Numbers.
What are real life applications of trees?
 Have you ever used XML? XML parser uses tree data structure.
 Have you heard of decision tree based learning? A machine learning algorithm.
 Do you know the domain name server (DNS)? It also uses a tree data structure.
 All software applications in the world somehow they are using map/hashmap.
Hashmap has its internal implementation is an AVL tree.
 You know database also uses tree data structure for indexing.
 Are you on any social networking website? You can imagine tree there..
File system
Network Routin
Syntax tree

 Binary Search Tree - Used in many search applications where data is


constantly entering/leaving, such as the map and set objects in many
languages' libraries.
 Binary Space Partition - Used in almost every 3D video game to determine
what objects need to be rendered.
 Binary Tries - Used in almost every high-bandwidth router for storing router-
tables.
 Hash Trees - used in p2p programs and specialized image-signatures in which
a hash needs to be verified, but the whole file is not available.
 Heaps - Used in implementing efficient priority-queues, which in turn are used
for scheduling processes in many operating systems, Quality-of-Service in
routers, and A* (path-finding algorithm used in AI applications, including
robotics and video games). Also used in heap-sort.
 Huffman Coding Tree (Chip Uni) - used in compression algorithms, such as
those used by the .jpeg and .mp3 file-formats.
 GGM Trees - Used in cryptographic applications to generate a tree of pseudo-
random numbers.
 Syntax Tree - Constructed by compilers and (implicitly) calculators to parse
expressions.
 Treap - Randomized data structure used in wireless networking and memory
allocation.
 T-tree - Though most databases use some form of B-tree to store data on the
drive, databases which keep all (most) their data in memory often use T-trees
to do so.
AVL trees :-
 are beneficial in the cases where you are designing some database where insertions
and deletions are not that frequent but you have to frequently look-up for the items
present in there.
 Red Black Tyree:-
 The process scheduler in Linux uses Red Black Trees. The red black trees are a
replacement for run queues which had priorities for processes on the queue for the
scheduler to pick up from.
The Completely Fair Scheduler (CFS) is the name of a process scheduler which
was merged into the 2.6.23 release of the Linux kernel. It handles CPU resource
allocation for executing processes, and aims to maximize overall CPU utilization while
also maximizing interactive performance.

BTree : we use BTree in indexing large records in database to improve search.

Graph:-
Few important real life applications of graph data structures are:

1. Facebook: Each user is represented as a vertex and two people are friends
when there is an edge between two vertices. Similarly friend suggestion also
uses graph theory concept.
2. Google Maps: Various locations are represented as vertices and the roads are
represented as edges and graph theory is used to find shortest path between
two nodes.
3. Recommendations on e-commerce websites: The “Recommendations for you”
section on various e-commerce websites uses graph theory to recommend
items of similar type to user’s choice.
4. Graph theory is also used to study molecules in chemistry and physics.

Tries
Tries are an extremely special and useful data-structure that are based on the prefix of a
string. They are used to represent the “Retrieval” of data and thus the name Trie. A Trie is
a special data structure used to store strings that can be visualized like a graph.

Searching trees in general favor keys which are of fixed size since this leads
to efficient storage management.
•However in case of applications which are retrieval based and which call for
keys
varying length, tries provide better options.
•Tries are also called as Lexicographic Search trees.

How Google works:-

Crawling

Crawling is where it all begins – the acquisition of data about a website. This involves
scanning the site and getting a complete list of everything on there – the page title,
images, keywords it contains, and any other pages it links to – at a bare minimum.
Modern crawlers may cache a copy of the whole page, as well as look for some additional
information such as the page layout, where the advertising units are, where the links are
on the page (featured prominently in the article text, or hidden in the footer?).
Indexing

You’d be forgiven for thinking this is an easy step – indexing is the process of taking all
of that data you have from a crawl, and placing it in a big database. Imagine trying to a
make a list of all the books you own, their author and the number of pages. Going
through each book is the crawl and writing the list is the index. But now imagine it’s not
just a room full of books, but every library in the world. That’s pretty much a small-scale
version of what Google does.

All of this data is stored in vast data-centres with thousands of petabytes worth of
drives. Here’s a sneaky peak inside one of Google’s:

Ranking & Retrieval

The last step is what you see – you type in a search query, and the search engine
attempts to display the most relevant documents it finds that match your query. This is
the most complicated step, but also the most relevant to you or I, as web developers and
users. It is also the area in which search engines differentiate themselves (though, there
was some evidence that Bing was actually copying some Google results). Some work
with keywords, some allow you to ask a question, and some include advanced features
like keyword proximity or filtering by age of content.

“”

You might also like