SlideShare a Scribd company logo
ARTIFICIAL INTELLIGENCE
                     Paper Code : CSE 654




Submitted To:-Submitted By:-
Asst. Prof. SukhpreetKaurAanchal Raj
                                             B.E.(C.S.E.)
                                             Roll No.- SG10302


     Punjab University Swami SarvanandGiri Regional Centre
                            Hoshiarpur
INDEX
S.No.    Name of practical     Teacher’s Sign
  1.     Depth First Search
  2.    Breadth First Search
  3.
Experiment No. – 1
                           Aim :-To write a code for depth first search
#include<stdio.h>
#include<conio.h>
int q[ 20 ], top = -1, front = -1, rear = -1, a[ 20 ][ 20 ], vis[ 20 ], stack[ 20 ];

int delete();

void add ( int item );

voiddfs( int s, int n );

void push( int item );

int pop();

main()
{
int n, i, s, ch, j;
printf( "ENTER THE NUMBER VERTICES " );
scanf( "%d", &n );

for ( i = 1;i <= n;i++ )
     {
for ( j = 1;j <= n;j++ )
           {
printf( "ENTER 1 IF %d HAS A NODE WITH %d ELSE 0 ", i, j );
scanf( "%d", &a[ i ][ j ] );
           }
     }

printf( "THE ADJACENCY MATRIX ISn" );

for ( i = 1;i <= n;i++ )
     {
for ( j = 1;j <= n;j++ )
           {
printf( " %d", a[ i ][ j ] );
           }

printf( "n" );
     }
do
      {
for ( i = 1;i <= n;i++ )
vis[ i ] = 0;

printf( "ENTER THE SOURCE VERTEX :" );

scanf( "%d", &s );

dfs( s, n );

getch();

}

voiddfs( int s, int n )
{
int i, k;
   push( s );
vis[ s ] = 1;
   k = pop();

if ( k != 0 )
          printf( " %d ", k );

while ( k != 0 )
         {
         for ( i = 1;i <= n;i++ )
                   if ( ( a[ k ][ i ] != 0 ) && ( vis[ i ] == 0 ) )
                       {
                              push( i );
                              vis[ i ] = 1;
                       }

               k = pop();

           if ( k != 0 )
                     printf( " %d ", k );
           }

for ( i = 1;i <= n;i++ )
          if ( vis[ i ] == 0 )
          dfs( i, n );
}

void add
( int item )
   {
if ( rear == 19 )
printf( "QUEUE FULL" );
else
        {
if ( rear == -1 )
             {
q[ ++rear ] = item;
front++;
             }
else
q[ ++rear ] = item;
        }
    }

int delete()
{
int k;

if ( ( front > rear ) || ( front == -1 ) )
return ( 0 );
else
       {
         k = q[ front++ ];
return ( k );
       }
}
void push( int item )
{
if ( top == 19 )
           printf( "Stack overflow " );
else
           stack[ ++top ] = item;
}

int pop()
{
int k;

if ( top == -1 )
          return ( 0 );
else
          {
            k = stack[ top-- ];
          return ( k );
          }
}
Experiment No. – 2
                        Aim :-To write a code for breadth first search
#include<stdio.h>
#include<conio.h>
int q[ 20 ], top = -1, front = -1, rear = -1, a[ 20 ][ 20 ], vis[ 20 ], stack[ 20 ];

int delete();

void add ( int item );

voidbfs( int s, int n );

void push( int item );

int pop();

main()
{
int n, i, s, ch, j;
printf( "ENTER THE NUMBER VERTICES " );
scanf( "%d", &n );

for ( i = 1;i <= n;i++ )
     {
for ( j = 1;j <= n;j++ )
           {
printf( "ENTER 1 IF %d HAS A NODE WITH %d ELSE 0 ", i, j );
scanf( "%d", &a[ i ][ j ] );
           }
     }

printf( "THE ADJACENCY MATRIX ISn" );

for ( i = 1;i <= n;i++ )
     {
for ( j = 1;j <= n;j++ )
           {
printf( " %d", a[ i ][ j ] );
           }

printf( "n" );
     }
for ( i = 1;i <= n;i++ )
vis[ i ] = 0;

printf( "ENTER THE SOURCE VERTEX :" );

scanf( "%d", &s );

dfs( s, n );

getch();

}

voidbfs( int s, int n )
{
int p, i;

add
( s );

vis[ s ] = 1;

    p = delete();

if ( p != 0 )
printf( " %d", p );

while ( p != 0 )
       {
for ( i = 1;i <= n;i++ )
           if ( ( a[ p ][ i ] != 0 ) && ( vis[ i ] == 0 ) )
              {
add
( i );

vis[ i ] = 1;
                }

         p = delete();

if ( p != 0 )
printf( " %d ", p );
      }

for ( i = 1;i <= n;i++ )
if ( vis[ i ] == 0 )
bfs( i, n );
}
void add( int item )
    {
if ( rear == 19 )
printf( "QUEUE FULL" );
else
        {
if ( rear == -1 )
             {
q[ ++rear ] = item;
front++;
             }
else
q[ ++rear ] = item;
        }
    }

int delete()
{
int k;

if ( ( front > rear ) || ( front == -1 ) )
return ( 0 );
else
       {
         k = q[ front++ ];
return ( k );
       }
}
void push( int item )
{
if ( top == 19 )
           printf( "Stack overflow " );
else
           stack[ ++top ] = item;
}

int pop()
{
int k;

if ( top == -1 )
          return ( 0 );
else
          {
            k = stack[ top-- ];
          return ( k );
          }
}

More Related Content

What's hot

Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
Ankit Kumar
 
C programs
C programsC programs
Ds
DsDs
Datastructures asignment
Datastructures asignmentDatastructures asignment
Datastructures asignment
sreekanth3dce
 
A Shiny Example-- R
A Shiny Example-- RA Shiny Example-- R
A Shiny Example-- R
Dr. Volkan OBAN
 
programs
programsprograms
programs
Vishnu V
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
Rahul Chugh
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
Hitesh Kumar
 
Program to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical orderProgram to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical order
Samsil Arefin
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignment
ashikul akash
 
cosc 281 hw2
cosc 281 hw2cosc 281 hw2
cosc 281 hw2
Brian Goggins
 
week-21x
week-21xweek-21x
Visualization team presentation
Visualization team presentation Visualization team presentation
Visualization team presentation
madhobilota
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
Arkadeep Dey
 
Oprerator overloading
Oprerator overloadingOprerator overloading
Oprerator overloading
Parthipan Parthi
 
Daa practicals
Daa practicalsDaa practicals
Daa practicals
Rekha Yadav
 
Blocks+gcd入門
Blocks+gcd入門Blocks+gcd入門
Blocks+gcd入門
領一 和泉田
 
contoh Program queue
contoh Program queuecontoh Program queue
contoh Program queue
Bina Sarana Informatika
 
Pnno
PnnoPnno
Ejercicios de programacion
Ejercicios de programacionEjercicios de programacion
Ejercicios de programacion
Jeff Tu Pechito
 

What's hot (20)

Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
 
C programs
C programsC programs
C programs
 
Ds
DsDs
Ds
 
Datastructures asignment
Datastructures asignmentDatastructures asignment
Datastructures asignment
 
A Shiny Example-- R
A Shiny Example-- RA Shiny Example-- R
A Shiny Example-- R
 
programs
programsprograms
programs
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Program to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical orderProgram to sort the n names in an alphabetical order
Program to sort the n names in an alphabetical order
 
Numerical Method Assignment
Numerical Method AssignmentNumerical Method Assignment
Numerical Method Assignment
 
cosc 281 hw2
cosc 281 hw2cosc 281 hw2
cosc 281 hw2
 
week-21x
week-21xweek-21x
week-21x
 
Visualization team presentation
Visualization team presentation Visualization team presentation
Visualization team presentation
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
 
Oprerator overloading
Oprerator overloadingOprerator overloading
Oprerator overloading
 
Daa practicals
Daa practicalsDaa practicals
Daa practicals
 
Blocks+gcd入門
Blocks+gcd入門Blocks+gcd入門
Blocks+gcd入門
 
contoh Program queue
contoh Program queuecontoh Program queue
contoh Program queue
 
Pnno
PnnoPnno
Pnno
 
Ejercicios de programacion
Ejercicios de programacionEjercicios de programacion
Ejercicios de programacion
 

Viewers also liked

Migration Capacity Assessment Outline Chanzo Final
Migration Capacity Assessment Outline Chanzo FinalMigration Capacity Assessment Outline Chanzo Final
Migration Capacity Assessment Outline Chanzo Final
Chanzo Osei Greenidge
 
Recover Canon Lost Photos
Recover Canon Lost PhotosRecover Canon Lost Photos
Recover Canon Lost Photos
emilylaurence1
 
NEF video Recovery
NEF video RecoveryNEF video Recovery
NEF video Recovery
emilylaurence1
 
Cytoskeleton
CytoskeletonCytoskeleton
Cytoskeleton
wre1997
 
Annie Liebovitz
Annie LiebovitzAnnie Liebovitz
Annie Liebovitz
mayagcsephotography
 
How To Flash Xbox 360 Firmware Tutorial by mksoftware
How To Flash Xbox 360 Firmware Tutorial by mksoftwareHow To Flash Xbox 360 Firmware Tutorial by mksoftware
How To Flash Xbox 360 Firmware Tutorial by mksoftware
Slamet Purwanto
 
Germany
GermanyGermany
Germany
Aditya Sharma
 
TEARS: An Emotionally Intelligent Action Planning Method
TEARS:  An Emotionally Intelligent Action Planning MethodTEARS:  An Emotionally Intelligent Action Planning Method
TEARS: An Emotionally Intelligent Action Planning Method
Chanzo Osei Greenidge
 
ACP Migration-Capacity Building Strategy Presentation-CGreenidge
ACP Migration-Capacity Building Strategy Presentation-CGreenidgeACP Migration-Capacity Building Strategy Presentation-CGreenidge
ACP Migration-Capacity Building Strategy Presentation-CGreenidge
Chanzo Osei Greenidge
 
Importance of PDHPE
Importance of PDHPEImportance of PDHPE
Importance of PDHPE
benb14
 
PDHPE importance.
PDHPE importance.PDHPE importance.
PDHPE importance.
benb14
 
IDRC Diaspora Study Presentation Toronto 1[1]
IDRC Diaspora Study Presentation Toronto 1[1]IDRC Diaspora Study Presentation Toronto 1[1]
IDRC Diaspora Study Presentation Toronto 1[1]
Chanzo Osei Greenidge
 
Changes to earths_surface
Changes to earths_surfaceChanges to earths_surface
Changes to earths_surface
brbeach
 
Harnessing Our Global Energy- Workshop on Diaspora and Diaspora PolicyMMU Con...
Harnessing Our Global Energy- Workshop on Diaspora and Diaspora PolicyMMU Con...Harnessing Our Global Energy- Workshop on Diaspora and Diaspora PolicyMMU Con...
Harnessing Our Global Energy- Workshop on Diaspora and Diaspora PolicyMMU Con...
Chanzo Osei Greenidge
 
Office for sale at TB Simatupang
Office for sale at TB SimatupangOffice for sale at TB Simatupang
Office for sale at TB Simatupang
dpeggypr
 
Translating Gaza Gender And Conflict In A Diasporic World
Translating Gaza  Gender And Conflict In A Diasporic WorldTranslating Gaza  Gender And Conflict In A Diasporic World
Translating Gaza Gender And Conflict In A Diasporic World
Chanzo Osei Greenidge
 
everydayhero-and-Emily-Dougan-Cure-Brain-Cancer-Foundation
everydayhero-and-Emily-Dougan-Cure-Brain-Cancer-Foundationeverydayhero-and-Emily-Dougan-Cure-Brain-Cancer-Foundation
everydayhero-and-Emily-Dougan-Cure-Brain-Cancer-Foundation
Emily Dougan
 
Tomorrow
TomorrowTomorrow
Tomorrow
photoshop
 
Food[1]
Food[1]Food[1]
Food[1]
photoshop
 

Viewers also liked (20)

Migration Capacity Assessment Outline Chanzo Final
Migration Capacity Assessment Outline Chanzo FinalMigration Capacity Assessment Outline Chanzo Final
Migration Capacity Assessment Outline Chanzo Final
 
Recover Canon Lost Photos
Recover Canon Lost PhotosRecover Canon Lost Photos
Recover Canon Lost Photos
 
NEF video Recovery
NEF video RecoveryNEF video Recovery
NEF video Recovery
 
Nzslide
NzslideNzslide
Nzslide
 
Cytoskeleton
CytoskeletonCytoskeleton
Cytoskeleton
 
Annie Liebovitz
Annie LiebovitzAnnie Liebovitz
Annie Liebovitz
 
How To Flash Xbox 360 Firmware Tutorial by mksoftware
How To Flash Xbox 360 Firmware Tutorial by mksoftwareHow To Flash Xbox 360 Firmware Tutorial by mksoftware
How To Flash Xbox 360 Firmware Tutorial by mksoftware
 
Germany
GermanyGermany
Germany
 
TEARS: An Emotionally Intelligent Action Planning Method
TEARS:  An Emotionally Intelligent Action Planning MethodTEARS:  An Emotionally Intelligent Action Planning Method
TEARS: An Emotionally Intelligent Action Planning Method
 
ACP Migration-Capacity Building Strategy Presentation-CGreenidge
ACP Migration-Capacity Building Strategy Presentation-CGreenidgeACP Migration-Capacity Building Strategy Presentation-CGreenidge
ACP Migration-Capacity Building Strategy Presentation-CGreenidge
 
Importance of PDHPE
Importance of PDHPEImportance of PDHPE
Importance of PDHPE
 
PDHPE importance.
PDHPE importance.PDHPE importance.
PDHPE importance.
 
IDRC Diaspora Study Presentation Toronto 1[1]
IDRC Diaspora Study Presentation Toronto 1[1]IDRC Diaspora Study Presentation Toronto 1[1]
IDRC Diaspora Study Presentation Toronto 1[1]
 
Changes to earths_surface
Changes to earths_surfaceChanges to earths_surface
Changes to earths_surface
 
Harnessing Our Global Energy- Workshop on Diaspora and Diaspora PolicyMMU Con...
Harnessing Our Global Energy- Workshop on Diaspora and Diaspora PolicyMMU Con...Harnessing Our Global Energy- Workshop on Diaspora and Diaspora PolicyMMU Con...
Harnessing Our Global Energy- Workshop on Diaspora and Diaspora PolicyMMU Con...
 
Office for sale at TB Simatupang
Office for sale at TB SimatupangOffice for sale at TB Simatupang
Office for sale at TB Simatupang
 
Translating Gaza Gender And Conflict In A Diasporic World
Translating Gaza  Gender And Conflict In A Diasporic WorldTranslating Gaza  Gender And Conflict In A Diasporic World
Translating Gaza Gender And Conflict In A Diasporic World
 
everydayhero-and-Emily-Dougan-Cure-Brain-Cancer-Foundation
everydayhero-and-Emily-Dougan-Cure-Brain-Cancer-Foundationeverydayhero-and-Emily-Dougan-Cure-Brain-Cancer-Foundation
everydayhero-and-Emily-Dougan-Cure-Brain-Cancer-Foundation
 
Tomorrow
TomorrowTomorrow
Tomorrow
 
Food[1]
Food[1]Food[1]
Food[1]
 

Similar to Artificial intelligence

Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
Er Ritu Aggarwal
 
ADA FILE
ADA FILEADA FILE
ADA FILE
Gaurav Singh
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
Nithin Kumar,VVCE, Mysuru
 
Programs
ProgramsPrograms
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
Lakshmi Sarvani Videla
 
data structure and algorithm.pdf
data structure and algorithm.pdfdata structure and algorithm.pdf
data structure and algorithm.pdf
Asrinath1
 
Data structure output 1
Data structure output 1Data structure output 1
Data structure output 1
Balaji Thala
 
Assignment on Numerical Method C Code
Assignment on Numerical Method C CodeAssignment on Numerical Method C Code
Assignment on Numerical Method C Code
Syed Ahmed Zaki
 
Cpds lab
Cpds labCpds lab
Coding
CodingCoding
C programs
C programsC programs
C programs
Koshy Geoji
 
งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์
น้ำตาล มาแล้วจ้า
 
Ada file
Ada fileAda file
Ada file
Kumar Gaurav
 
Os 2 cycle
Os 2 cycleOs 2 cycle
Os 2 cycle
Chaitanya Kn
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
Syed Tanveer
 
week-18x
week-18xweek-18x
week-17x
week-17xweek-17x
Computer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commandsComputer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commands
Vishvjeet Yadav
 
Struct examples
Struct examplesStruct examples
Struct examples
mondalakash2012
 
Programs for Operating System
Programs for Operating SystemPrograms for Operating System
Programs for Operating System
LPU
 

Similar to Artificial intelligence (20)

Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
Programs
ProgramsPrograms
Programs
 
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
 
data structure and algorithm.pdf
data structure and algorithm.pdfdata structure and algorithm.pdf
data structure and algorithm.pdf
 
Data structure output 1
Data structure output 1Data structure output 1
Data structure output 1
 
Assignment on Numerical Method C Code
Assignment on Numerical Method C CodeAssignment on Numerical Method C Code
Assignment on Numerical Method C Code
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
Coding
CodingCoding
Coding
 
C programs
C programsC programs
C programs
 
งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์งานนำเสนอ อาจารย์ลาวัลย์
งานนำเสนอ อาจารย์ลาวัลย์
 
Ada file
Ada fileAda file
Ada file
 
Os 2 cycle
Os 2 cycleOs 2 cycle
Os 2 cycle
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
 
week-18x
week-18xweek-18x
week-18x
 
week-17x
week-17xweek-17x
week-17x
 
Computer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commandsComputer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commands
 
Struct examples
Struct examplesStruct examples
Struct examples
 
Programs for Operating System
Programs for Operating SystemPrograms for Operating System
Programs for Operating System
 

Recently uploaded

Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
BibashShahi
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
Ajin Abraham
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
saastr
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
saastr
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 

Recently uploaded (20)

Principle of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptxPrinciple of conventional tomography-Bibash Shahi ppt..pptx
Principle of conventional tomography-Bibash Shahi ppt..pptx
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
AppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSFAppSec PNW: Android and iOS Application Security with MobSF
AppSec PNW: Android and iOS Application Security with MobSF
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
9 CEO's who hit $100m ARR Share Their Top Growth Tactics Nathan Latka, Founde...
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
Overcoming the PLG Trap: Lessons from Canva's Head of Sales & Head of EMEA Da...
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 

Artificial intelligence

  • 1. ARTIFICIAL INTELLIGENCE Paper Code : CSE 654 Submitted To:-Submitted By:- Asst. Prof. SukhpreetKaurAanchal Raj B.E.(C.S.E.) Roll No.- SG10302 Punjab University Swami SarvanandGiri Regional Centre Hoshiarpur
  • 2. INDEX S.No. Name of practical Teacher’s Sign 1. Depth First Search 2. Breadth First Search 3.
  • 3. Experiment No. – 1 Aim :-To write a code for depth first search #include<stdio.h> #include<conio.h> int q[ 20 ], top = -1, front = -1, rear = -1, a[ 20 ][ 20 ], vis[ 20 ], stack[ 20 ]; int delete(); void add ( int item ); voiddfs( int s, int n ); void push( int item ); int pop(); main() { int n, i, s, ch, j; printf( "ENTER THE NUMBER VERTICES " ); scanf( "%d", &n ); for ( i = 1;i <= n;i++ ) { for ( j = 1;j <= n;j++ ) { printf( "ENTER 1 IF %d HAS A NODE WITH %d ELSE 0 ", i, j ); scanf( "%d", &a[ i ][ j ] ); } } printf( "THE ADJACENCY MATRIX ISn" ); for ( i = 1;i <= n;i++ ) { for ( j = 1;j <= n;j++ ) { printf( " %d", a[ i ][ j ] ); } printf( "n" ); }
  • 4. do { for ( i = 1;i <= n;i++ ) vis[ i ] = 0; printf( "ENTER THE SOURCE VERTEX :" ); scanf( "%d", &s ); dfs( s, n ); getch(); } voiddfs( int s, int n ) { int i, k; push( s ); vis[ s ] = 1; k = pop(); if ( k != 0 ) printf( " %d ", k ); while ( k != 0 ) { for ( i = 1;i <= n;i++ ) if ( ( a[ k ][ i ] != 0 ) && ( vis[ i ] == 0 ) ) { push( i ); vis[ i ] = 1; } k = pop(); if ( k != 0 ) printf( " %d ", k ); } for ( i = 1;i <= n;i++ ) if ( vis[ i ] == 0 ) dfs( i, n ); } void add ( int item ) {
  • 5. if ( rear == 19 ) printf( "QUEUE FULL" ); else { if ( rear == -1 ) { q[ ++rear ] = item; front++; } else q[ ++rear ] = item; } } int delete() { int k; if ( ( front > rear ) || ( front == -1 ) ) return ( 0 ); else { k = q[ front++ ]; return ( k ); } } void push( int item ) { if ( top == 19 ) printf( "Stack overflow " ); else stack[ ++top ] = item; } int pop() { int k; if ( top == -1 ) return ( 0 ); else { k = stack[ top-- ]; return ( k ); } }
  • 6. Experiment No. – 2 Aim :-To write a code for breadth first search #include<stdio.h> #include<conio.h> int q[ 20 ], top = -1, front = -1, rear = -1, a[ 20 ][ 20 ], vis[ 20 ], stack[ 20 ]; int delete(); void add ( int item ); voidbfs( int s, int n ); void push( int item ); int pop(); main() { int n, i, s, ch, j; printf( "ENTER THE NUMBER VERTICES " ); scanf( "%d", &n ); for ( i = 1;i <= n;i++ ) { for ( j = 1;j <= n;j++ ) { printf( "ENTER 1 IF %d HAS A NODE WITH %d ELSE 0 ", i, j ); scanf( "%d", &a[ i ][ j ] ); } } printf( "THE ADJACENCY MATRIX ISn" ); for ( i = 1;i <= n;i++ ) { for ( j = 1;j <= n;j++ ) { printf( " %d", a[ i ][ j ] ); } printf( "n" ); }
  • 7. for ( i = 1;i <= n;i++ ) vis[ i ] = 0; printf( "ENTER THE SOURCE VERTEX :" ); scanf( "%d", &s ); dfs( s, n ); getch(); } voidbfs( int s, int n ) { int p, i; add ( s ); vis[ s ] = 1; p = delete(); if ( p != 0 ) printf( " %d", p ); while ( p != 0 ) { for ( i = 1;i <= n;i++ ) if ( ( a[ p ][ i ] != 0 ) && ( vis[ i ] == 0 ) ) { add ( i ); vis[ i ] = 1; } p = delete(); if ( p != 0 ) printf( " %d ", p ); } for ( i = 1;i <= n;i++ ) if ( vis[ i ] == 0 ) bfs( i, n ); }
  • 8. void add( int item ) { if ( rear == 19 ) printf( "QUEUE FULL" ); else { if ( rear == -1 ) { q[ ++rear ] = item; front++; } else q[ ++rear ] = item; } } int delete() { int k; if ( ( front > rear ) || ( front == -1 ) ) return ( 0 ); else { k = q[ front++ ]; return ( k ); } } void push( int item ) { if ( top == 19 ) printf( "Stack overflow " ); else stack[ ++top ] = item; } int pop() { int k; if ( top == -1 ) return ( 0 ); else { k = stack[ top-- ]; return ( k ); }
  • 9. }