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
/* | |
Author : @Rajat Shah | |
Written: 2013 as a part of Assignment for Aritifial Intelligence course taken at VNIT, Nagpur | |
Task: Solving 8-tile puzzle using A* algorithm with Manhattan Distance as Heuristic. | |
Comments: Configurations can be done from the macro declarations | |
0 can be considered as the blank position | |
Sample Solvable Initial State: | |
1 | 4 | 2 | |
3 | 5 | 0 |
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
/* | |
Author : @Rajat Shah | |
Task: Solving N Queen using Genetic Algorithm. | |
Comments: Hard coded for 8x8 chess, can be modified for arbitrary size. | |
*/ | |
#include<iostream> | |
#include<cmath> | |
#include<cstdlib> | |
#include<algorithm> |
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
/* | |
Name : Rajat Shah | |
Task : Implement DFS and BFS for an undirected graph and unweighted graph. | |
Notes: Contains hard-coded map of the city to be searched, uses just string reprentation of city(nodes)! | |
Instructions to compile and run: | |
To compile: | |
g++ BFSDFS.cpp |
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
class LRUCache{ | |
private: | |
map<int,list<pair<int, int>>::iterator> keyToListItr; //key to list node* | |
list<pair<int,int>> clist; | |
int capacity; | |
public: | |
LRUCache(int capacity) { | |
this->capacity = capacity; | |
} | |