SlideShare a Scribd company logo
1 of 26
NADAR SARASWATHI COLLEGE OF ARTS&SCIENCE,THENI
DEPARTMENT OF COMPUTER
SCIENCE&INFORMATION TECHNOLOGY
V.VANMATHY
I-MSC(CS)
DATA STRUCTURE
ALGORITHMS
0/1 knapsack least cost
branch and bound&FIFO
branch and bound
TOPIC:
0/1 knapsack least cost branch and bound
Given N items with weight W[0…..n-1],values
V[0…..n-1] and a knapsack with capacity C select the
items such that:
1. The sum of weight taken into the knapsack I less
than or equal to c.
2. The sum of values of the items in the knapsack I
maximum among all the possible combinations
0/1 knapsack least cost branch and bound
Input: N=4,C=15,V[]={10,10,12,18},W[]={2,4,6,9}
Output:
Items taken into the knapsack are
1101
Maximum profit is 38
Explanation:
1 in the output indicates that the item is included in
the knapsack while 0 indicates that the item I
excluded.
0/1 knapsack least cost branch and bound
Since the maximum possible cost all owed is 15, the
ways to select items are:
(1101)->cost=2+4+9=15,profit=10+10+18=38
(0011)->cost=6+9=15,profit=12+18=30
(1110)->cost=2+4+6=12,profit=32
Hence,maximum profit possible wit hin a cost of 15
is 38.
0/1 knapsack least cost branch and bound
Input: N=4,C=21,V[]={18,20,14,18},w[]={6,3,5,9}
Output:
Items taken into the knapsack are
1101
Maximum profit is 56
Explanation:
Cost=6+3+9=18
Profit=18+20+18=56
Least cost
Upper= node:1 profit: 10 10 12 18
M=15 weight:2 4 6 9
c=-38u=-32 c=10+10+12+18/9*3
u=10+10+12 2 + 4 + 6
u=-32
upper value find the value remove 12
the value 18/9*3 find the answer 15-12=3
u=-32 c=10+10+12+2*3
c=-38
1
c
Least cost
18/9*5 remove value c=10+10+12+18/9*5
find the value u answer 2+ 4+6
u=-32
x=1 c=-38 10
u=-32 x=0 15-10=5
c=-38 c=-32 u=-22 c=10+12+10
c=-32
u=10+12
node: 2,3 u=-22
1
2 3
Least cost
c=10+10+12+18/9*7
u=-32 2+ 4+6
c=-38
u=-32 x=1 x=0 8
c=-38 c=-32 u=-22 15-8=7
x=0 x=1 c=10+12+14
u=-32 u=-22 c=-36
c=-38 c=-36 u=10+12
u=-22
Node:4,5
1
2 3
4 5
Least cost
c=10+10+12+18
u=-32 2+ 4+6 +9
x=1 c=-38
u=-32 x=0
c=-38 c=-32 u=-22
x=1 x=0 c=10+10+18
u=-32 u=-22 c=-38
c=-38 c=-36 u=10+10+18
x=1 x=0 u=-38
Node:7 u=-38
c=-38
1
2 3
4 5
6
7
k
Least cost
u=-32 lower bound>upper bound
x=1 x=0 c=-38 -20>-38
u=-32 u=-22 kill value node 9
c=-38 c=-32
x=1 x=0
u=-32 u=-22
x=1 x=0c=-38 c=-36 c=10+10
u=-32 u=-38 2+4
c=-38 c=-38 c=20
x=1 x=0
u=-38 node: 9
c=-38 k c=-20
1
3
2
4 5
6 7
8 9
k
X={1,1,0,1}
10+10+0+18=38
2+4+0+9=15
FIFO branch and bound solution
Draw the portion of the state space tree generated by the
FIFO BB technique for the knapsack instance of n=5
m=12
(p1,p2,p3,p4,p5)=(10,1,6,8,4)
(w1,w2,w3,w4,w5)=(4,6,3,4,2)
0/1 knapsack problem is a maximization problem but we
require FIFO BB knapsack problem, I a minimization
problem.
Hence,we convert the +ve profits into –ve profits.
Hence, the problem is converted from maximization
problem to minimization problem.
FIFO EXAMPLE
FIFO
FIFO
FIFO
FIFO
FIFO
FIFO
FIFO
FIFO
FIFO
FIFO
FIFO
FIFO
Data structure and algorithm

More Related Content

What's hot

Coordinate Geometry Concept Class
Coordinate Geometry Concept ClassCoordinate Geometry Concept Class
Coordinate Geometry Concept ClassGeorge Prep
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's AlgorithmArijitDhali
 
Karmarkar's Algorithm For Linear Programming Problem
Karmarkar's Algorithm For Linear Programming ProblemKarmarkar's Algorithm For Linear Programming Problem
Karmarkar's Algorithm For Linear Programming ProblemAjay Dhamija
 
5.3 dynamic programming
5.3 dynamic programming5.3 dynamic programming
5.3 dynamic programmingKrish_ver2
 
application of complex numbers
application of complex numbersapplication of complex numbers
application of complex numbersKaustubh Garud
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithmguest862df4e
 
Sum of subsets problem by backtracking 
Sum of subsets problem by backtracking Sum of subsets problem by backtracking 
Sum of subsets problem by backtracking Hasanain Alshadoodee
 
Counting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probabilityCounting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probabilitySURBHI SAROHA
 
Longest common subsequence
Longest common subsequenceLongest common subsequence
Longest common subsequenceKiran K
 
Presentation on Solution to non linear equations
Presentation on Solution to non linear equationsPresentation on Solution to non linear equations
Presentation on Solution to non linear equationsRifat Rahamatullah
 
0/1 knapsack
0/1 knapsack0/1 knapsack
0/1 knapsackAmin Omi
 
The two dimensional wave equation
The two dimensional wave equationThe two dimensional wave equation
The two dimensional wave equationGermán Ceballos
 
Dijkstra s algorithm
Dijkstra s algorithmDijkstra s algorithm
Dijkstra s algorithmmansab MIRZA
 
ANALYSIS-AND-DESIGN-OF-ALGORITHM.ppt
ANALYSIS-AND-DESIGN-OF-ALGORITHM.pptANALYSIS-AND-DESIGN-OF-ALGORITHM.ppt
ANALYSIS-AND-DESIGN-OF-ALGORITHM.pptDaveCalapis3
 

What's hot (20)

numerical methods
numerical methodsnumerical methods
numerical methods
 
Coordinate Geometry Concept Class
Coordinate Geometry Concept ClassCoordinate Geometry Concept Class
Coordinate Geometry Concept Class
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
Karmarkar's Algorithm For Linear Programming Problem
Karmarkar's Algorithm For Linear Programming ProblemKarmarkar's Algorithm For Linear Programming Problem
Karmarkar's Algorithm For Linear Programming Problem
 
5.3 dynamic programming
5.3 dynamic programming5.3 dynamic programming
5.3 dynamic programming
 
Daa notes 1
Daa notes 1Daa notes 1
Daa notes 1
 
Strassen.ppt
Strassen.pptStrassen.ppt
Strassen.ppt
 
application of complex numbers
application of complex numbersapplication of complex numbers
application of complex numbers
 
Dijkstra's Algorithm
Dijkstra's AlgorithmDijkstra's Algorithm
Dijkstra's Algorithm
 
graph theory
graph theory graph theory
graph theory
 
Sum of subsets problem by backtracking 
Sum of subsets problem by backtracking Sum of subsets problem by backtracking 
Sum of subsets problem by backtracking 
 
Counting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probabilityCounting, mathematical induction and discrete probability
Counting, mathematical induction and discrete probability
 
Longest common subsequence
Longest common subsequenceLongest common subsequence
Longest common subsequence
 
Presentation on Solution to non linear equations
Presentation on Solution to non linear equationsPresentation on Solution to non linear equations
Presentation on Solution to non linear equations
 
0/1 knapsack
0/1 knapsack0/1 knapsack
0/1 knapsack
 
The two dimensional wave equation
The two dimensional wave equationThe two dimensional wave equation
The two dimensional wave equation
 
Dijkstra s algorithm
Dijkstra s algorithmDijkstra s algorithm
Dijkstra s algorithm
 
ANALYSIS-AND-DESIGN-OF-ALGORITHM.ppt
ANALYSIS-AND-DESIGN-OF-ALGORITHM.pptANALYSIS-AND-DESIGN-OF-ALGORITHM.ppt
ANALYSIS-AND-DESIGN-OF-ALGORITHM.ppt
 
complex numbers
complex numberscomplex numbers
complex numbers
 
Pigeon hole principle
Pigeon hole principlePigeon hole principle
Pigeon hole principle
 

Similar to Data structure and algorithm

MODI_SteppingStone.pptx
MODI_SteppingStone.pptxMODI_SteppingStone.pptx
MODI_SteppingStone.pptxVivekSaurabh7
 
Non linear function
Non linear functionNon linear function
Non linear functionvenyclaudia
 
Homework4 b00346910
Homework4 b00346910Homework4 b00346910
Homework4 b00346910vbit
 
Chapter 12 Dynamic programming.pptx
Chapter 12 Dynamic programming.pptxChapter 12 Dynamic programming.pptx
Chapter 12 Dynamic programming.pptxMdSazolAhmmed
 
OR_Presentation on muli item deterministic inventory model
OR_Presentation on muli item deterministic inventory modelOR_Presentation on muli item deterministic inventory model
OR_Presentation on muli item deterministic inventory modelKiranMittal7
 
Pembahasan soal un matematika smp tahun 2014 paket 1-www.olimattohir.blogspot...
Pembahasan soal un matematika smp tahun 2014 paket 1-www.olimattohir.blogspot...Pembahasan soal un matematika smp tahun 2014 paket 1-www.olimattohir.blogspot...
Pembahasan soal un matematika smp tahun 2014 paket 1-www.olimattohir.blogspot...Mathematics Sport
 
Unit-2 Branch & Bound Design of Algorithms.ppt
Unit-2 Branch & Bound Design of Algorithms.pptUnit-2 Branch & Bound Design of Algorithms.ppt
Unit-2 Branch & Bound Design of Algorithms.pptHarjotDhillon8
 
A NEW APPROACH FOR SOLVING TRANSPORTATION PROBLEM
A NEW APPROACH FOR SOLVING TRANSPORTATION PROBLEMA NEW APPROACH FOR SOLVING TRANSPORTATION PROBLEM
A NEW APPROACH FOR SOLVING TRANSPORTATION PROBLEMJournal For Research
 
Dynamic Programming Matrix Chain Multiplication
Dynamic Programming Matrix Chain MultiplicationDynamic Programming Matrix Chain Multiplication
Dynamic Programming Matrix Chain MultiplicationKrishnakoumarC
 
Quantitative techniques for MBA (QDM)
Quantitative techniques for MBA (QDM)Quantitative techniques for MBA (QDM)
Quantitative techniques for MBA (QDM)npazare
 
Question 1 1. Evaluate using integration by parts. l.docx
Question 1 1. Evaluate using integration by parts. l.docxQuestion 1 1. Evaluate using integration by parts. l.docx
Question 1 1. Evaluate using integration by parts. l.docxmakdul
 
Transportation problem
Transportation problemTransportation problem
Transportation problemShubhagata Roy
 
Solucionário Fundamentos Circuitos Elétricos 5ª Ed.pdf
Solucionário Fundamentos Circuitos Elétricos 5ª Ed.pdfSolucionário Fundamentos Circuitos Elétricos 5ª Ed.pdf
Solucionário Fundamentos Circuitos Elétricos 5ª Ed.pdfpedro199229
 
Fundamentals_of_Electric_Circuits_Instructor_Solutions_Manual_by.pdf
Fundamentals_of_Electric_Circuits_Instructor_Solutions_Manual_by.pdfFundamentals_of_Electric_Circuits_Instructor_Solutions_Manual_by.pdf
Fundamentals_of_Electric_Circuits_Instructor_Solutions_Manual_by.pdfissackmohamed3
 

Similar to Data structure and algorithm (20)

MODI_SteppingStone.pptx
MODI_SteppingStone.pptxMODI_SteppingStone.pptx
MODI_SteppingStone.pptx
 
MODI
MODIMODI
MODI
 
Non linear function
Non linear functionNon linear function
Non linear function
 
Unit 3-Greedy Method
Unit 3-Greedy MethodUnit 3-Greedy Method
Unit 3-Greedy Method
 
Economic Optimization Numerical
Economic Optimization NumericalEconomic Optimization Numerical
Economic Optimization Numerical
 
Homework4 b00346910
Homework4 b00346910Homework4 b00346910
Homework4 b00346910
 
Chapter 12 Dynamic programming.pptx
Chapter 12 Dynamic programming.pptxChapter 12 Dynamic programming.pptx
Chapter 12 Dynamic programming.pptx
 
OR_Presentation on muli item deterministic inventory model
OR_Presentation on muli item deterministic inventory modelOR_Presentation on muli item deterministic inventory model
OR_Presentation on muli item deterministic inventory model
 
Pembahasan soal un matematika smp tahun 2014 paket 1-www.olimattohir.blogspot...
Pembahasan soal un matematika smp tahun 2014 paket 1-www.olimattohir.blogspot...Pembahasan soal un matematika smp tahun 2014 paket 1-www.olimattohir.blogspot...
Pembahasan soal un matematika smp tahun 2014 paket 1-www.olimattohir.blogspot...
 
Unit-2 Branch & Bound Design of Algorithms.ppt
Unit-2 Branch & Bound Design of Algorithms.pptUnit-2 Branch & Bound Design of Algorithms.ppt
Unit-2 Branch & Bound Design of Algorithms.ppt
 
Ch 03
Ch 03Ch 03
Ch 03
 
A NEW APPROACH FOR SOLVING TRANSPORTATION PROBLEM
A NEW APPROACH FOR SOLVING TRANSPORTATION PROBLEMA NEW APPROACH FOR SOLVING TRANSPORTATION PROBLEM
A NEW APPROACH FOR SOLVING TRANSPORTATION PROBLEM
 
Dynamic Programming Matrix Chain Multiplication
Dynamic Programming Matrix Chain MultiplicationDynamic Programming Matrix Chain Multiplication
Dynamic Programming Matrix Chain Multiplication
 
Quantitative techniques for MBA (QDM)
Quantitative techniques for MBA (QDM)Quantitative techniques for MBA (QDM)
Quantitative techniques for MBA (QDM)
 
Question 1 1. Evaluate using integration by parts. l.docx
Question 1 1. Evaluate using integration by parts. l.docxQuestion 1 1. Evaluate using integration by parts. l.docx
Question 1 1. Evaluate using integration by parts. l.docx
 
12
1212
12
 
Transportation problem
Transportation problemTransportation problem
Transportation problem
 
C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
 
Solucionário Fundamentos Circuitos Elétricos 5ª Ed.pdf
Solucionário Fundamentos Circuitos Elétricos 5ª Ed.pdfSolucionário Fundamentos Circuitos Elétricos 5ª Ed.pdf
Solucionário Fundamentos Circuitos Elétricos 5ª Ed.pdf
 
Fundamentals_of_Electric_Circuits_Instructor_Solutions_Manual_by.pdf
Fundamentals_of_Electric_Circuits_Instructor_Solutions_Manual_by.pdfFundamentals_of_Electric_Circuits_Instructor_Solutions_Manual_by.pdf
Fundamentals_of_Electric_Circuits_Instructor_Solutions_Manual_by.pdf
 

More from vanmathy1

VANMATHY V cloud computing
VANMATHY V cloud computingVANMATHY V cloud computing
VANMATHY V cloud computingvanmathy1
 
VANMATHY V.pptx
VANMATHY V.pptxVANMATHY V.pptx
VANMATHY V.pptxvanmathy1
 
vanmathy v DIP.pptx
vanmathy v DIP.pptxvanmathy v DIP.pptx
vanmathy v DIP.pptxvanmathy1
 
Compiler design
Compiler design Compiler design
Compiler design vanmathy1
 
Advanced Java programming
Advanced Java programmingAdvanced Java programming
Advanced Java programmingvanmathy1
 

More from vanmathy1 (6)

VANMATHY V cloud computing
VANMATHY V cloud computingVANMATHY V cloud computing
VANMATHY V cloud computing
 
VANMATHY V
VANMATHY  VVANMATHY  V
VANMATHY V
 
VANMATHY V.pptx
VANMATHY V.pptxVANMATHY V.pptx
VANMATHY V.pptx
 
vanmathy v DIP.pptx
vanmathy v DIP.pptxvanmathy v DIP.pptx
vanmathy v DIP.pptx
 
Compiler design
Compiler design Compiler design
Compiler design
 
Advanced Java programming
Advanced Java programmingAdvanced Java programming
Advanced Java programming
 

Recently uploaded

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 

Recently uploaded (20)

_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 

Data structure and algorithm

  • 1. NADAR SARASWATHI COLLEGE OF ARTS&SCIENCE,THENI DEPARTMENT OF COMPUTER SCIENCE&INFORMATION TECHNOLOGY V.VANMATHY I-MSC(CS)
  • 2. DATA STRUCTURE ALGORITHMS 0/1 knapsack least cost branch and bound&FIFO branch and bound TOPIC:
  • 3. 0/1 knapsack least cost branch and bound Given N items with weight W[0…..n-1],values V[0…..n-1] and a knapsack with capacity C select the items such that: 1. The sum of weight taken into the knapsack I less than or equal to c. 2. The sum of values of the items in the knapsack I maximum among all the possible combinations
  • 4. 0/1 knapsack least cost branch and bound Input: N=4,C=15,V[]={10,10,12,18},W[]={2,4,6,9} Output: Items taken into the knapsack are 1101 Maximum profit is 38 Explanation: 1 in the output indicates that the item is included in the knapsack while 0 indicates that the item I excluded.
  • 5. 0/1 knapsack least cost branch and bound Since the maximum possible cost all owed is 15, the ways to select items are: (1101)->cost=2+4+9=15,profit=10+10+18=38 (0011)->cost=6+9=15,profit=12+18=30 (1110)->cost=2+4+6=12,profit=32 Hence,maximum profit possible wit hin a cost of 15 is 38.
  • 6. 0/1 knapsack least cost branch and bound Input: N=4,C=21,V[]={18,20,14,18},w[]={6,3,5,9} Output: Items taken into the knapsack are 1101 Maximum profit is 56 Explanation: Cost=6+3+9=18 Profit=18+20+18=56
  • 7. Least cost Upper= node:1 profit: 10 10 12 18 M=15 weight:2 4 6 9 c=-38u=-32 c=10+10+12+18/9*3 u=10+10+12 2 + 4 + 6 u=-32 upper value find the value remove 12 the value 18/9*3 find the answer 15-12=3 u=-32 c=10+10+12+2*3 c=-38 1 c
  • 8. Least cost 18/9*5 remove value c=10+10+12+18/9*5 find the value u answer 2+ 4+6 u=-32 x=1 c=-38 10 u=-32 x=0 15-10=5 c=-38 c=-32 u=-22 c=10+12+10 c=-32 u=10+12 node: 2,3 u=-22 1 2 3
  • 9. Least cost c=10+10+12+18/9*7 u=-32 2+ 4+6 c=-38 u=-32 x=1 x=0 8 c=-38 c=-32 u=-22 15-8=7 x=0 x=1 c=10+12+14 u=-32 u=-22 c=-36 c=-38 c=-36 u=10+12 u=-22 Node:4,5 1 2 3 4 5
  • 10. Least cost c=10+10+12+18 u=-32 2+ 4+6 +9 x=1 c=-38 u=-32 x=0 c=-38 c=-32 u=-22 x=1 x=0 c=10+10+18 u=-32 u=-22 c=-38 c=-38 c=-36 u=10+10+18 x=1 x=0 u=-38 Node:7 u=-38 c=-38 1 2 3 4 5 6 7 k
  • 11. Least cost u=-32 lower bound>upper bound x=1 x=0 c=-38 -20>-38 u=-32 u=-22 kill value node 9 c=-38 c=-32 x=1 x=0 u=-32 u=-22 x=1 x=0c=-38 c=-36 c=10+10 u=-32 u=-38 2+4 c=-38 c=-38 c=20 x=1 x=0 u=-38 node: 9 c=-38 k c=-20 1 3 2 4 5 6 7 8 9 k X={1,1,0,1} 10+10+0+18=38 2+4+0+9=15
  • 12. FIFO branch and bound solution Draw the portion of the state space tree generated by the FIFO BB technique for the knapsack instance of n=5 m=12 (p1,p2,p3,p4,p5)=(10,1,6,8,4) (w1,w2,w3,w4,w5)=(4,6,3,4,2) 0/1 knapsack problem is a maximization problem but we require FIFO BB knapsack problem, I a minimization problem. Hence,we convert the +ve profits into –ve profits. Hence, the problem is converted from maximization problem to minimization problem.
  • 14. FIFO
  • 15. FIFO
  • 16. FIFO
  • 17. FIFO
  • 18. FIFO
  • 19. FIFO
  • 20. FIFO
  • 21. FIFO
  • 22. FIFO
  • 23. FIFO
  • 24. FIFO
  • 25. FIFO