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
| # | |
| # A dead simple python that generates a file.out with randomly integers between -1024 and +1024 without duplicates. | |
| # I use it when sorting something in c++ | |
| # | |
| # Usage: | |
| # | |
| # python genvec 10 | |
| # | |
| # ->[9,8,7,6,5,4,3,2,1,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
| /* | |
| * @ Description: Kruskal's Algorithm. | |
| * @ Author: Adrian Statescu <mergesortv@gmail.com>, <http://thinkphp.ro> | |
| * @ License: MIT | |
| * | |
| * @ using vector<pair <int, pair<int,int> > > and iterator for display | |
| */ | |
| #include <cstdio> | |
| #include <algorithm> | |
| #include <vector> |
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
| /* | |
| * @ Description: Kosaraju's Algorithm. | |
| * @ Author: Adrian Statescu <mergesortv@gmail.com>, <http://thinkphp.ro> | |
| * @ License: MIT | |
| * | |
| * @ using Depth First Search and DFS Reverse | |
| */ | |
| #include <cstdio> | |
| #include <vector> | |
| #include <stack> |
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
| /** | |
| * Filename : dijkstra.cpp | |
| * Author : Adrian Statescu <http://thinkphp.ro> | |
| * Description : Dijkstra's Algorithm for Shortest Path Directed Graph. | |
| */ | |
| #include <cstdio> | |
| #include <vector> | |
| #include <queue> | |
| #define FIN "dijkstra.in" | |
| #define FOUT "dijkstra.out" |
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 <stdio.h> | |
| #define MAXN 100005 | |
| #define FIN "ctc.in" | |
| #define FOUT "ctc.out" | |
| struct Node { | |
| int y; | |
| Node *next; | |
| } *L1[ MAXN ], //first list | |
| *L2[ MAXN ], //second list |
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 <stdio.h> | |
| #define MAXN 100005 | |
| #define FIN "ctc.in" | |
| #define FOUT "ctc.out" | |
| struct Node { | |
| int y; | |
| Node *next; | |
| } *L1[ MAXN ], //first list | |
| *L2[ MAXN ], //second list |
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
| /** | |
| * HeapSort.py - Heap Sort Algorithm Sorting an array of randomly permuted values | |
| * Copyright (c) 2015, Adrian Statescu (MIT License) <http://thinkphp.ro>, <mergesortv@gmail.com> | |
| */ | |
| class HeapSort | |
| def initialize( filename, output ) | |
| @sizeHeap = 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
| # | |
| # HeapSort.py - Heap Sort Algorithm Sorting an array of randomly permuted of values. | |
| # Website <http://thinkphp.ro>(MIT License). | |
| # Email <mergesortv@gmail.com>. | |
| # Copyright (c) 2015, Adrian Statescu. | |
| # | |
| class HeapSort: | |
| def __init__(self, arr): |
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
| /** | |
| * A complex number is a number that can be expressed in the form a + bi, | |
| * where a and b are real numbers and i is the imaginary unit, | |
| * that satisfies the equation i^2 = -1. | |
| */ | |
| #include <fstream> | |
| #include <iostream> | |
| #include <vector> | |
| #include <cmath> | |
| #define FIN "complex.in" |
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
| import math | |
| class Complex: | |
| def __init__( self, a, b ): | |
| self.a = a | |
| self.b = b | |
| def getModule( self ): |