This file contains hidden or 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; | |
// DFS technique uses Stack. As, we are implementing it using recursion it automatically uses Stack structure | |
void DFS(int G[][7],int start,int n){ | |
static int visited[7] = {0}; | |
if(visited[start]!=1){ | |
cout << start << " "; | |
visited[start] = 1; |
This file contains hidden or 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; | |
// This is Implementation of Queue | |
struct Node { | |
int data; | |
struct Node *next; | |
}*front=NULL,*rear=NULL; |
This file contains hidden or 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
def rotate_string(a, b) | |
return false if a!=b && a.length != b.length | |
a = a*3 | |
return true if a.include?(b) | |
return false | |
end |
This file contains hidden or 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; | |
int hash_(int key){ | |
return key%10; | |
} | |
int insert_probe(int HT[],int key){ | |
int i=1,pindex; | |
while(1){ |
This file contains hidden or 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; | |
struct Node{ | |
int data; | |
struct Node *next; | |
}; | |
int hash_(int key) | |
{ |
This file contains hidden or 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; | |
struct Node{ | |
int data; | |
struct Node *next; | |
}; | |
int main(){ |
This file contains hidden or 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
def corp_flight_bookings(bookings, n) | |
min_max = [] | |
return bookings if bookings.empty? or bookings[0].empty? | |
bookings.each do |i| | |
min_max << i[0] << i[1] | |
min_max << 1 if i[0]!=1 and i[1]!=1 | |
end | |
min_max.sort! | |
min_max.uniq! | |
min = min_max.first |
This file contains hidden or 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; | |
vector <int> a = {0}; | |
void insert(int ele){ | |
int temp; | |
a.push_back(ele); | |
long last = a.size()-1; |
This file contains hidden or 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; | |
vector <int> a = {0}; | |
void insert(int ele){ | |
int temp; | |
a.push_back(ele); | |
long last = a.size()-1; |
This file contains hidden or 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
# Problem Code : CHFM | |
elements = [] | |
count = [] | |
a = [] | |
n = gets.to_i | |
return if !n | |
n.to_i.times do | |
count << gets.to_i |