This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
#include<stdlib.h> | |
#define SIZE 5 | |
void enQueue(int); | |
void deQueue(); | |
void display(); | |
int cQueue[SIZE], front = -1, rear = -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
int a[20][20],reach[20],n; | |
void dfs(int v) { | |
int i; | |
reach[v]=1; | |
for (i=1;i<=n;i++) | |
if(a[v][i] && !reach[i]) { | |
printf("\n %d->%d",v,i); | |
dfs(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://www.thecrazyprogrammer.com/2015/09/breadth-first-search-bfs-program-in-c.html | |
#include<stdio.h> | |
#include<stdlib.h> | |
#define MAX 100 | |
#define initial 1 | |
#define waiting 2 | |
#define visited 3 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
struct node | |
{ | |
int val; | |
struct node *next; | |
struct node *prev; | |
}; | |
typedef struct node n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
struct node | |
{ | |
int data; | |
struct node *link; | |
}; | |
struct node *head = NULL, *x, *y, *z; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
// Consider an actual class. | |
class Obj { | |
static int i, j; | |
public: | |
void f() const { cout << i++ << endl; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
const int SIZE = 10; | |
class safearay { | |
private: | |
int arr[SIZE]; | |
public: | |
safearay() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Distance { | |
private: | |
int feet; // 0 to infinite | |
int inches; // 0 to 12 | |
public: | |
// required constructors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Distance { | |
private: | |
int feet; // 0 to infinite | |
int inches; // 0 to 12 | |
public: | |
// required constructors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Distance { | |
private: | |
int feet; // 0 to infinite | |
int inches; // 0 to 12 | |
public: | |
// required constructors |
NewerOlder