Skip to content

Instantly share code, notes, and snippets.

View samagragupta's full-sized avatar
🎯
Focusing

Samagra Gupta samagragupta

🎯
Focusing
View GitHub Profile
View pikaC.l
%{
#include <cstdio>
#include "pikaC.tab.h" // to get the token types from Bison
#include <string.h>
#include <stdlib.h>
char* strdup (const char* s)
{
size_t slen = strlen(s);
char* result = (char*) malloc(slen + 1);
View hill_beam.py
import random
global_hillClimbing = 1
global_beamSearch = 1
global_variableNeighbourhoodDescent = 1
def clauseGen(n, m, k):
var = []
clauses = []
doneVars = []
View k-sat.cpp
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
const int MAX=26;
int main()
{
int k,n,m;
cout<<"k=";
cin>>k;
cout<<"n=";
View Q2-BFS.py
class Node:
parent = None
def __init__(self,state):
self.state = state
def setParent(self,parent):
self.parent = parent
def Backtrack(p):
count=0
while p.parent!=None:
View Q1-BFS.py
class Node:
parent = None
def __init__(self,state):
self.state = state
def setParent(self,parent):
self.parent = parent
def BackTrack(p):
View Q2-DFS.py
class Node:
parent = None
def __init__(self,state):
self.state = state
def setParent(self,parent):
self.parent = parent
def Backtrack(p):
count=0
while p.parent!=None:
View Q1-DFS.py
class Node:
parent = None
def __init__(self,state):
self.state = state
def setParent(self,parent):
self.parent = parent
def BackTrack(p):
View Q1-DFS.py
class Node:
parent = None
def __init__(self,state):
self.state = state
def setParent(self,parent):
self.parent = parent
def BackTrack(p):
View Codeheat_2018-2019.md