Data Structures Used in Artificial Intelligence
Data Structures Used in Artificial Intelligence
ARTIFICIAL INTELLIGENCE
Dr.S.Veena
Professor
Computer Science and Engineering
SRMIST
Topics
• Definition of Artificial Intelligence
• Introduction to Data Structures
• Stacks
• Queues
• Trees
• Graphs
Artificial Intelligence
• Artificial intelligence is the science of making machines
that can think like humans. It can do things that are
considered "smart."
• AI technology can process large amounts of data in
ways, unlike humans.
• The goal for AI is to be able to do things such as
recognize patterns, make decisions, and judge like
humans.
Artificial Intelligence - Examples
Data Structures in AI
• Data structures are ways of organizing and storing data in a computer
memory,
• Some popular data structures for AI include arrays, lists, stacks, queues, trees,
and graphs.
• Arrays are fixed-size collections of elements of the same type, useful for
storing sequential data.
• Lists are dynamic collections that can contain different types, perfect for
data that needs to grow or shrink.
• Stacks use the last-in, first-out (LIFO) principle and are suitable for
processing data in reverse order.
• Queues utilize the first-in, first-out (FIFO) principle and are ideal for
handling data that needs to be processed in order.
• Trees are hierarchical collections of nodes with parent-child relationships
and work well with data that has a natural structure.
• Graphs are collections of nodes connected by edges and can represent
complex relationships such as networks or maps.
Stacks
• Stack - Last In First Out (LIFO) lists
An ordered list; a sequence of items, piled one on top of the other.
The insertions and deletions are made at one end only, called Top.
• To use data structures and algorithms in AI, the user need to understand the nature
and requirements of your problem and the characteristics and trade-offs of the
options.
• To help the user to choose and apply data structures and algorithms in AI, it's
important to first define your problem, analyze your data, select a data structure,
select an algorithm, and then evaluate your solution.
• Defining the problem means outlining the goal of your AI system, the inputs and
outputs, as well as the constraints and assumptions.
• Analyzing the data requires understanding its type, size, distribution, how it is
stored/accessed/processed/manipulated.
• Selecting a data structure involves considering its suitability for data
type/size/operations, advantages/disadvantages, implementation/testing.
• The same goes for selecting an algorithm - it should be suitable for problem
goal/data structure/performance criteria with advantages/disadvantages that are
implemented and tested.
• Finally, evaluating the solution means assessing how well it solves the problem,
its speed/accuracy/scalability, and how it can be improved.
Examples of data structures and algorithms in
AI
• For example, image recognition involves identifying and
labeling objects in an image, which can be solved using an array
to store the image pixels, a tree to store the image features,
and a neural network to classify the image.
• Pathfinding is the problem of finding the shortest or cheapest
path between two points on a map, which can be solved by using a
graph to store the map nodes and edges, a queue to store the
frontier nodes, and A* search to find the optimal path.
• The traveling salesman problem is solving for the shortest or
cheapest route that visits a set of cities and returns to the
starting point; this can be done by using a list to store the city
names and distances, a stack to store the current route, and a
genetic algorithm to find the optimal route.
Benefits of data structures and algorithms in AI
• Using data structures and algorithms in AI can bring many
benefits to your system and your development process, such as
efficiency, accuracy, and creativity.
• Data structures and algorithms can help optimize the use of
computer resources, reduce time and space complexity,
and improve performance and scalability.
• Additionally, they can help improve the quality and reliability
of your system by handling errors, uncertainties, and outliers in
your data.
• Moreover, data structures and algorithms can help explore
new possibilities for your problem by modeling complex and
dynamic data and creating innovative and adaptive systems.