SlideShare a Scribd company logo
1 of 32
Submitted by:
Name: Rajat Kumar
Registration Number: 12010023
Course: B.tech CSE
A PROJECT REPORT
Submitted in partial fulfillment of the requirements for the award of degree of
B.Tech
Submitted to
LOVELY PROFESSIONAL UNIVERSITY
PHAGWARA, PUNJAB
.
.
Project
Name – Rajat Kumar
In this project, the player has to move a
snake so it touches the fruit. If the snake
touches itself or the border of the game
then the game will over.
Data Structures and Algorithms (DSA)
 A data structure is a named location that can be used to store and
organize data. And, an algorithm is a collection of steps to solve a
particular problem.
 Learning data structures and algorithms allow us to write efficient
and optimized computer programs.
 A computer program is a collection of instructions to perform a
specific task.
 For this, a computer program may need to store data, retrieve
data, and perform computations on the data.
Good Computer Program
 A computer program is a series of instructions to carry out a particular task
written in a language that a computer can understand.
 The process of preparing and feeding the instructions into the computer for
execution is referred as programming.
 There are a number of features for a good program
• Run efficiently and correctly Have a user friendly interface
• Be easy to read and understand
• Be easy to debug
• Be easy to modify
• Be easy to maintain
What is an Algorithm?
 In computer programming terms, an algorithm is a set of well-defined instructions
to solve a particular problem. It takes a set of input(s) and produces the desired
output. For example,
 An algorithm to add two numbers:
• Take two number inputs
• Add numbers using the + operator
• Display the result
Qualities of a Good Algorithm
• Input and output should be defined precisely.
• Each step in the algorithm should be clear and unambiguous.
• Algorithms should be most effective among many different
ways to solve a problem.
• An algorithm shouldn't include computer code. Instead, the
algorithm should be written in such a way that it can be used
in different programming languages.
Types of Data Structure
 Linear data structures
In linear data structures, the elements are arranged in
sequence one after the other. Since elements are arranged
in particular order, they are easy to implement.
However, when the complexity of the program increases, the
linear data structures might not be the best choice because
of operational complexities.
Types of Data Structure
 Non linear data structures
Unlike linear data structures, elements in non-
linear data structures are not in any sequence.
Instead they are arranged in a hierarchical
manner where one element will be connected to
one or more elements.
Asymptotic Analysis
 The efficiency of an algorithm depends on the amount of
time, storage and other resources required to execute the
algorithm. The efficiency is measured with the help of
asymptotic notations.
 An algorithm may not have the same performance for
different types of inputs. With the increase in the input
size, the performance will change.
 The study of change in performance of the algorithm with
the change in the order of the input size is defined as
asymptotic analysis.
Big-O Notation
Asymptotic Notations
 Asymptotic notations are the mathematical notations used to describe the
running time of an algorithm when the input tends towards a particular value or a
limiting value.
 For example: In bubble sort, when the input array is already sorted, the time
taken by the algorithm is linear i.e. the best case.
 But, when the input array is in reverse condition, the algorithm takes the
maximum time (quadratic) to sort the elements i.e. the worst case.
 When the input array is neither sorted nor in reverse order, then it takes average
time. These durations are denoted using asymptotic notations.
 There are mainly three asymptotic notations:
• Big-O notation
• Omega notation
• Theta notation
Divide and Conquer Algorithm
 A divide and conquer algorithm is a strategy of solving a large problem by
1. breaking the problem into smaller sub-problems
2. solving the sub-problems, and
3. combining them to get the desired output.
 To use the divide and conquer algorithm, recursion is used. Learn about
recursion in different programming languages:
• Recursion in Java
• Recursion in Python
• Recursion in C++
How Divide and Conquer Algorithms Work?
Here are the steps involved:
1. Divide: Divide the given problem into sub-problems using recursion.
2. Conquer: Solve the smaller sub-problems recursively. If the subproblem is small
enough, then solve it directly.
3. Combine: Combine the solutions of the sub-problems that are part of the
recursive process to solve the actual problem.
Stack Data Structure
 A stack is a linear data structure that follows the principle of Last In First
Out (LIFO). This means the last element inserted inside the stack is
removed first.
 You can think of the stack data structure as the pile of plates on top of
another.
 Here, you can:
• Put a new plate on top
• Remove the top plate
 And, if you want the plate at the bottom, you must first remove all the plates
on top. This is exactly how the stack data structure works.
Basic Operations of Stack
 There are some basic operations that allow us to perform
different actions on a stack.
• Push: Add an element to the top of a stack
• Pop: Remove an element from the top of a stack
• IsEmpty: Check if the stack is empty
• IsFull: Check if the stack is full
• Peek: Get the value of the top element without removing it
Applications of Stack Data Structure
 Although stack is a simple data structure to implement, it is very powerful. The most common uses of
a stack are:
 To reverse a word - Put all the letters in a stack and pop them out. Because of the LIFO order of stack,
you will get the letters in reverse order.
 In compilers - Compilers use the stack to calculate the value of expressions like 2 + 4 / 5 * (7 - 9) by
converting the expression to prefix or postfix form.
 In browsers - The back button in a browser saves all the URLs you have visited previously in a stack.
Each time you visit a new page, it is added on top of the stack. When you press the back button, the
current URL is removed from the stack, and the previous URL is accessed.
Queue Data Structure
 A queue is a useful data structure in
programming. It is similar to the ticket
queue outside a cinema hall, where
the first person entering the queue is
the first person who gets the ticket.
 Queue follows the First In First Out
(FIFO) rule - the item that goes in first
is the item that comes out first.
Basic Operations of Queue
 A queue is an object (an abstract data structure - ADT) that
allows the following operations:
• Enqueue: Add an element to the end of the queue
• Dequeue: Remove an element from the front of the queue
• IsEmpty: Check if the queue is empty
• IsFull: Check if the queue is full
• Peek: Get the value of the front of the queue without removing
it
Applications of Queue
• CPU scheduling, Disk Scheduling
• When data is transferred asynchronously between
two processes.The queue is used for
synchronization. For example: IO Buffers, pipes, file
IO, etc
• Handling of interrupts in real-time systems.
• Call Center phone systems use Queues to hold
people calling them in order.
Types of Queues
 A queue is a useful data structure in programming. It is
similar to the ticket queue outside a cinema hall, where the
first person entering the queue is the first person who gets
the ticket.
 There are four different types of queues:
• Simple Queue
• Circular Queue
• Priority Queue
• Double Ended Queue
Deque Data Structure
 Deque or Double Ended Queue is a type of queue in which insertion and removal
of elements can either be performed from the front or the rear. Thus, it does not
follow FIFO rule (First In First Out).
Types of Deque
• Input Restricted Deque
In this deque, input is restricted at a single end
but allows deletion at both the ends.
• Output Restricted Deque
In this deque, output is restricted at a single
end but allows insertion at both the ends.
Dynamic Programming
 Dynamic Programming is a technique in computer
programming that helps to efficiently solve a class
of problems that have overlapping subproblems
and optimal substructure property.
 If any problem can be divided into subproblems,
which in turn are divided into smaller subproblems,
and if there are overlapping among these
subproblems, then the solutions to these
subproblems can be saved for future reference.
 In this way, efficiency of the CPU can be enhanced.
This method of solving a solution is referred to as
dynamic programming.
Recursion vs Dynamic Programming
 Dynamic programming is mostly applied to recursive
algorithms. This is not a coincidence, most
optimization problems require recursion and dynamic
programming is used for optimization.
 But not all problems that use recursion can use
Dynamic Programming. Unless there is a presence of
overlapping subproblems like in the fibonacci
sequence problem, a recursion can only reach the
solution using a divide and conquer approach.
Greedy Algorithms vs Dynamic Programming
 Greedy Algorithms are similar to dynamic programming in the
sense that they are both tools for optimization.
 However, greedy algorithms look for locally optimum
solutions or in other words, a greedy choice, in the hopes of
finding a global optimum. Hence greedy algorithms can make
a guess that looks optimum at the time but becomes costly
down the line and do not guarantee a globally optimum.
 Dynamic programming, on the other hand, finds the optimal
solution to subproblems and then makes an informed choice
to combine the results of those subproblems to find the most
optimum solution.
Backtracking Algorithm
 A backtracking algorithm is a problem-solving algorithm
that uses a brute force approach for finding the
desired output.
 The term backtracking suggests that if the current
solution is not suitable, then backtrack and try other
solutions. Thus, recursion is used in this approach.
 This approach is used to solve problems that have
multiple solutions. If you want an optimal solution, you
must go for dynamic programming.
State Space Tree
 A space state tree is a tree representing all the possible states (solution or
nonsolution) of the problem from the root as an initial state to the leaf as a
terminal state.
Conclusion
 In conclusion, data structures are a great tool to computer science and the professionals
who utilize them.
 Data structures have their advantages and disadvantages like everything in our lives. Only
advance users can make changes to data structures, and any problem involving data
structure will need a professional to rectify.
 Luckily, there are more advantages than there are disadvantages.
 Data structures allow information storage, it provides the means for management of large
data like databases, work together and are necessary for efficient algorithms, safe storage
of data, allows easier processing of data, and the use of the internet to access data anytime.
 With those odds, this makes it easy to accept that without these applications in our lives, life
would be that much harder when dealing with computer science and even our day to day
tasks
RAJAT PROJECT.pptx

More Related Content

Similar to RAJAT PROJECT.pptx

ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdfADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdfRGPV De Bunkers
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Dr. Pankaj Agarwal
 
Data Structures in C
Data Structures in CData Structures in C
Data Structures in CJabs6
 
ADS Introduction
ADS IntroductionADS Introduction
ADS IntroductionNagendraK18
 
Data Structures and Algorithm - Module 1.pptx
Data Structures and Algorithm - Module 1.pptxData Structures and Algorithm - Module 1.pptx
Data Structures and Algorithm - Module 1.pptxEllenGrace9
 
Algorithm analysis (All in one)
Algorithm analysis (All in one)Algorithm analysis (All in one)
Algorithm analysis (All in one)jehan1987
 
Data Structure Notes unit 1.docx
Data Structure Notes unit 1.docxData Structure Notes unit 1.docx
Data Structure Notes unit 1.docxkp370932
 
Basic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - NotesBasic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - NotesOmprakash Chauhan
 
Introduction to Data Structure & algorithm
Introduction to Data Structure & algorithmIntroduction to Data Structure & algorithm
Introduction to Data Structure & algorithmSunita Bhosale
 
DA lecture 3.pptx
DA lecture 3.pptxDA lecture 3.pptx
DA lecture 3.pptxSayanSen36
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxSyed Zaid Irshad
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithmsiqbalphy1
 
Introduction to Data Structure
Introduction to Data Structure Introduction to Data Structure
Introduction to Data Structure Prof Ansari
 
Unit 1 Introduction Part 3.pptx
Unit 1 Introduction Part 3.pptxUnit 1 Introduction Part 3.pptx
Unit 1 Introduction Part 3.pptxNishaRohit6
 
Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptxTadiwaMawere
 
Design and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit oneDesign and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit onessuserb7c8b8
 

Similar to RAJAT PROJECT.pptx (20)

ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdfADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
 
Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis Introduction to Algorithms Complexity Analysis
Introduction to Algorithms Complexity Analysis
 
U nit i data structure-converted
U nit   i data structure-convertedU nit   i data structure-converted
U nit i data structure-converted
 
Data Structures in C
Data Structures in CData Structures in C
Data Structures in C
 
ADS Introduction
ADS IntroductionADS Introduction
ADS Introduction
 
Data Structures and Algorithm - Module 1.pptx
Data Structures and Algorithm - Module 1.pptxData Structures and Algorithm - Module 1.pptx
Data Structures and Algorithm - Module 1.pptx
 
Algorithm analysis (All in one)
Algorithm analysis (All in one)Algorithm analysis (All in one)
Algorithm analysis (All in one)
 
Data Structure Notes unit 1.docx
Data Structure Notes unit 1.docxData Structure Notes unit 1.docx
Data Structure Notes unit 1.docx
 
Basic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - NotesBasic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - Notes
 
Lec1
Lec1Lec1
Lec1
 
Lec1
Lec1Lec1
Lec1
 
Introduction to Data Structure & algorithm
Introduction to Data Structure & algorithmIntroduction to Data Structure & algorithm
Introduction to Data Structure & algorithm
 
DA lecture 3.pptx
DA lecture 3.pptxDA lecture 3.pptx
DA lecture 3.pptx
 
Design and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptxDesign and Analysis of Algorithms.pptx
Design and Analysis of Algorithms.pptx
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
 
Introduction to Data Structure
Introduction to Data Structure Introduction to Data Structure
Introduction to Data Structure
 
Unit 1 Introduction Part 3.pptx
Unit 1 Introduction Part 3.pptxUnit 1 Introduction Part 3.pptx
Unit 1 Introduction Part 3.pptx
 
Problem-solving and design 1.pptx
Problem-solving and design 1.pptxProblem-solving and design 1.pptx
Problem-solving and design 1.pptx
 
Design and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit oneDesign and Analysis of Algorithm ppt for unit one
Design and Analysis of Algorithm ppt for unit one
 
Cs 331 Data Structures
Cs 331 Data StructuresCs 331 Data Structures
Cs 331 Data Structures
 

Recently uploaded

Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 

Recently uploaded (20)

Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 

RAJAT PROJECT.pptx

  • 1. Submitted by: Name: Rajat Kumar Registration Number: 12010023 Course: B.tech CSE
  • 2. A PROJECT REPORT Submitted in partial fulfillment of the requirements for the award of degree of B.Tech Submitted to LOVELY PROFESSIONAL UNIVERSITY PHAGWARA, PUNJAB
  • 3.
  • 4. . .
  • 5. Project Name – Rajat Kumar In this project, the player has to move a snake so it touches the fruit. If the snake touches itself or the border of the game then the game will over.
  • 6. Data Structures and Algorithms (DSA)  A data structure is a named location that can be used to store and organize data. And, an algorithm is a collection of steps to solve a particular problem.  Learning data structures and algorithms allow us to write efficient and optimized computer programs.  A computer program is a collection of instructions to perform a specific task.  For this, a computer program may need to store data, retrieve data, and perform computations on the data.
  • 7. Good Computer Program  A computer program is a series of instructions to carry out a particular task written in a language that a computer can understand.  The process of preparing and feeding the instructions into the computer for execution is referred as programming.  There are a number of features for a good program • Run efficiently and correctly Have a user friendly interface • Be easy to read and understand • Be easy to debug • Be easy to modify • Be easy to maintain
  • 8.
  • 9. What is an Algorithm?  In computer programming terms, an algorithm is a set of well-defined instructions to solve a particular problem. It takes a set of input(s) and produces the desired output. For example,  An algorithm to add two numbers: • Take two number inputs • Add numbers using the + operator • Display the result
  • 10. Qualities of a Good Algorithm • Input and output should be defined precisely. • Each step in the algorithm should be clear and unambiguous. • Algorithms should be most effective among many different ways to solve a problem. • An algorithm shouldn't include computer code. Instead, the algorithm should be written in such a way that it can be used in different programming languages.
  • 11. Types of Data Structure  Linear data structures In linear data structures, the elements are arranged in sequence one after the other. Since elements are arranged in particular order, they are easy to implement. However, when the complexity of the program increases, the linear data structures might not be the best choice because of operational complexities.
  • 12. Types of Data Structure  Non linear data structures Unlike linear data structures, elements in non- linear data structures are not in any sequence. Instead they are arranged in a hierarchical manner where one element will be connected to one or more elements.
  • 13. Asymptotic Analysis  The efficiency of an algorithm depends on the amount of time, storage and other resources required to execute the algorithm. The efficiency is measured with the help of asymptotic notations.  An algorithm may not have the same performance for different types of inputs. With the increase in the input size, the performance will change.  The study of change in performance of the algorithm with the change in the order of the input size is defined as asymptotic analysis. Big-O Notation
  • 14. Asymptotic Notations  Asymptotic notations are the mathematical notations used to describe the running time of an algorithm when the input tends towards a particular value or a limiting value.  For example: In bubble sort, when the input array is already sorted, the time taken by the algorithm is linear i.e. the best case.  But, when the input array is in reverse condition, the algorithm takes the maximum time (quadratic) to sort the elements i.e. the worst case.  When the input array is neither sorted nor in reverse order, then it takes average time. These durations are denoted using asymptotic notations.  There are mainly three asymptotic notations: • Big-O notation • Omega notation • Theta notation
  • 15. Divide and Conquer Algorithm  A divide and conquer algorithm is a strategy of solving a large problem by 1. breaking the problem into smaller sub-problems 2. solving the sub-problems, and 3. combining them to get the desired output.  To use the divide and conquer algorithm, recursion is used. Learn about recursion in different programming languages: • Recursion in Java • Recursion in Python • Recursion in C++
  • 16. How Divide and Conquer Algorithms Work? Here are the steps involved: 1. Divide: Divide the given problem into sub-problems using recursion. 2. Conquer: Solve the smaller sub-problems recursively. If the subproblem is small enough, then solve it directly. 3. Combine: Combine the solutions of the sub-problems that are part of the recursive process to solve the actual problem.
  • 17. Stack Data Structure  A stack is a linear data structure that follows the principle of Last In First Out (LIFO). This means the last element inserted inside the stack is removed first.  You can think of the stack data structure as the pile of plates on top of another.  Here, you can: • Put a new plate on top • Remove the top plate  And, if you want the plate at the bottom, you must first remove all the plates on top. This is exactly how the stack data structure works.
  • 18. Basic Operations of Stack  There are some basic operations that allow us to perform different actions on a stack. • Push: Add an element to the top of a stack • Pop: Remove an element from the top of a stack • IsEmpty: Check if the stack is empty • IsFull: Check if the stack is full • Peek: Get the value of the top element without removing it
  • 19. Applications of Stack Data Structure  Although stack is a simple data structure to implement, it is very powerful. The most common uses of a stack are:  To reverse a word - Put all the letters in a stack and pop them out. Because of the LIFO order of stack, you will get the letters in reverse order.  In compilers - Compilers use the stack to calculate the value of expressions like 2 + 4 / 5 * (7 - 9) by converting the expression to prefix or postfix form.  In browsers - The back button in a browser saves all the URLs you have visited previously in a stack. Each time you visit a new page, it is added on top of the stack. When you press the back button, the current URL is removed from the stack, and the previous URL is accessed.
  • 20. Queue Data Structure  A queue is a useful data structure in programming. It is similar to the ticket queue outside a cinema hall, where the first person entering the queue is the first person who gets the ticket.  Queue follows the First In First Out (FIFO) rule - the item that goes in first is the item that comes out first.
  • 21. Basic Operations of Queue  A queue is an object (an abstract data structure - ADT) that allows the following operations: • Enqueue: Add an element to the end of the queue • Dequeue: Remove an element from the front of the queue • IsEmpty: Check if the queue is empty • IsFull: Check if the queue is full • Peek: Get the value of the front of the queue without removing it
  • 22. Applications of Queue • CPU scheduling, Disk Scheduling • When data is transferred asynchronously between two processes.The queue is used for synchronization. For example: IO Buffers, pipes, file IO, etc • Handling of interrupts in real-time systems. • Call Center phone systems use Queues to hold people calling them in order.
  • 23. Types of Queues  A queue is a useful data structure in programming. It is similar to the ticket queue outside a cinema hall, where the first person entering the queue is the first person who gets the ticket.  There are four different types of queues: • Simple Queue • Circular Queue • Priority Queue • Double Ended Queue
  • 24. Deque Data Structure  Deque or Double Ended Queue is a type of queue in which insertion and removal of elements can either be performed from the front or the rear. Thus, it does not follow FIFO rule (First In First Out).
  • 25. Types of Deque • Input Restricted Deque In this deque, input is restricted at a single end but allows deletion at both the ends. • Output Restricted Deque In this deque, output is restricted at a single end but allows insertion at both the ends.
  • 26. Dynamic Programming  Dynamic Programming is a technique in computer programming that helps to efficiently solve a class of problems that have overlapping subproblems and optimal substructure property.  If any problem can be divided into subproblems, which in turn are divided into smaller subproblems, and if there are overlapping among these subproblems, then the solutions to these subproblems can be saved for future reference.  In this way, efficiency of the CPU can be enhanced. This method of solving a solution is referred to as dynamic programming.
  • 27. Recursion vs Dynamic Programming  Dynamic programming is mostly applied to recursive algorithms. This is not a coincidence, most optimization problems require recursion and dynamic programming is used for optimization.  But not all problems that use recursion can use Dynamic Programming. Unless there is a presence of overlapping subproblems like in the fibonacci sequence problem, a recursion can only reach the solution using a divide and conquer approach.
  • 28. Greedy Algorithms vs Dynamic Programming  Greedy Algorithms are similar to dynamic programming in the sense that they are both tools for optimization.  However, greedy algorithms look for locally optimum solutions or in other words, a greedy choice, in the hopes of finding a global optimum. Hence greedy algorithms can make a guess that looks optimum at the time but becomes costly down the line and do not guarantee a globally optimum.  Dynamic programming, on the other hand, finds the optimal solution to subproblems and then makes an informed choice to combine the results of those subproblems to find the most optimum solution.
  • 29. Backtracking Algorithm  A backtracking algorithm is a problem-solving algorithm that uses a brute force approach for finding the desired output.  The term backtracking suggests that if the current solution is not suitable, then backtrack and try other solutions. Thus, recursion is used in this approach.  This approach is used to solve problems that have multiple solutions. If you want an optimal solution, you must go for dynamic programming.
  • 30. State Space Tree  A space state tree is a tree representing all the possible states (solution or nonsolution) of the problem from the root as an initial state to the leaf as a terminal state.
  • 31. Conclusion  In conclusion, data structures are a great tool to computer science and the professionals who utilize them.  Data structures have their advantages and disadvantages like everything in our lives. Only advance users can make changes to data structures, and any problem involving data structure will need a professional to rectify.  Luckily, there are more advantages than there are disadvantages.  Data structures allow information storage, it provides the means for management of large data like databases, work together and are necessary for efficient algorithms, safe storage of data, allows easier processing of data, and the use of the internet to access data anytime.  With those odds, this makes it easy to accept that without these applications in our lives, life would be that much harder when dealing with computer science and even our day to day tasks