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
| /* | |
| * DEMO OF BFS (Breadth First Search) | |
| *************************************** | |
| * | |
| * PROBLEM STATEMENT | |
| *------------------- | |
| * Given an undirected graph consisting of N nodes (labelled 1 to N) where | |
| * a specific given node S represents the start position and an edge between | |
| * any two nodes is of length 6 units in the graph. | |
| * |
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
| #!/usr/bin/env python | |
| import socket | |
| import os | |
| import sys | |
| PACKET_SIZE = 1024 | |
| class Server: | |
| def __init__(self, port, timeout=0.5): |
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
| tree = [0 for x in range(1000)] | |
| def countNodes(root): | |
| pass | |
| def addChildren(children, parent): | |
| tree[parent<<1] = children[0] | |
| tree[parent<<1|1] = children[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 "modular.hpp" | |
| using namespace std; | |
| int main(){ | |
| modular<7> a,b,c,d; | |
| a=3; | |
| b=8; | |
| c=-5; | |
| cout<<a()<<" "<<b()<<" "<<c()<<endl; // expected 3 1 2 |
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
| #ifndef NETSEC_MODULAR_HPP_INCLUDED__ | |
| #define NETSEC_MODULAR_HPP_INCLUDED__ | |
| class modularInverseException: public std::exception{ | |
| virtual const char *what() const throw(){ | |
| return "Modular Inverse does not exist in this case."; | |
| } | |
| } modularInverseDoesNotExist; | |
| template<int Mod> |
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
| /* | |
| * *WARNING* | |
| * If you are not familiar with bit manipulations and bitwise programming | |
| * go study them first. | |
| * | |
| ************************************************************************** | |
| * | |
| * This is the solution to the practice problem 'Breaking into Atoms' | |
| * on Codechef. Link to problem : http://www.codechef.com/problems/ATOMS | |
| * |
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
| /* | |
| * This is the solution to problem 'Princess Farida' on SPOJ. Link : http://www.spoj.com/problems/FARIDA/ | |
| * | |
| * The problem can be solved using Dynamic Programming, the recurrence | |
| * relation for the DP is : | |
| * DP[i] = INPUT[i] + MAX( DP[i-2], DP[i-3] ) ... Think yourself 'why ?' | |
| * | |
| * Now, as we see that the DP requires only upto 3rd previous term, we can | |
| * minimize the storage required to 4 values only and use a cyclic array | |
| * for the DP. Carefully study the solution to see how. |
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
| #!/usr/bin/env python | |
| ''' | |
| CSS Validator Automation Script | |
| ******************************* | |
| Validates all css files in a given directory and writes | |
| errors and warnings to log files in a separate directory. | |
| Ganesh Prasad Sahoo (c) 2015 |
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> | |
| #include <algorithm> | |
| #include <sstream> | |
| #include <string> | |
| #include <queue> | |
| #include <deque> | |
| #include <set> | |
| #include <list> | |
| #include <map> |
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> | |
| #include <algorithm> | |
| #include <sstream> | |
| #include <string> | |
| #include <queue> | |
| #include <deque> | |
| #include <set> | |
| #include <list> | |
| #include <map> |