text stringlengths 1 24.5M |
|---|
/*
* @lc app=leetcode.cn id=72 lang=cpp
*
* [72] 编辑è·ç¦»
*/
// @lc code=start
class Solution {
public:
int minDistance(string word1, string word2) {
}
};
// @lc code=end
|
// @before-stub-for-debug-begin
#include <vector>
#include <string>
#include "commoncppproblem720.h"
using namespace std;
// @before-stub-for-debug-end
/*
* @lc app=leetcode.cn id=720 lang=cpp
*
* [720] è¯å…¸ä¸æœ€é•¿çš„å•è¯
*/
#include <vector>
#include <map>
#include <string>
using namespace std;
// @lc code=s... |
/*
* @lc app=leetcode.cn id=721 lang=cpp
*
* [721] 账户åˆå¹¶
*/
// @lc code=start
class Solution {
public:
vector<vector<string>> accountsMerge(vector<vector<string>>& accounts) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=725 lang=cpp
*
* [725] 分隔链表
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
vector<ListNode*> splitListToParts(ListNo... |
/*
* @lc app=leetcode.cn id=726 lang=cpp
*
* [726] 原å的数é‡
*/
// @lc code=start
class Solution {
public:
string countOfAtoms(string formula) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=732 lang=cpp
*
* [732] 我的日程安排表 III
*/
// @lc code=start
struct Node{
public:
int start, end;
int maxTime = 0;
int delatTime = 0;
Node *left;
Node *right;
Node(int _start, int _end) : start(_start), end(_end), left(NULL), right(NULL) {
}
};
clas... |
/*
* @lc app=leetcode.cn id=735 lang=cpp
*
* [735] 行星碰撞
*/
#include <queue>
using namespace std;
// @lc code=start
class Solution {
public:
vector<int> asteroidCollision(vector<int>& asteroids)
{
vector<int> ans;
int n = asteroids.size();
for (int i = 0; i < n; ++i) {
... |
/*
* @lc app=leetcode.cn id=736 lang=cpp
*
* [736] Lisp è¯æ³•è§£æž
*/
// @lc code=start
class Solution {
public:
int evaluate(string expression) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=739 lang=cpp
*
* [739] æ¯æ—¥æ¸©åº¦
*/
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <unordered_set>
using namespace std;
// @lc code=start
class Solution {
public:
vector<int> dailyTemperatur... |
/*
* @lc app=leetcode.cn id=743 lang=cpp
*
* [743] 网络延迟时间
*/
// @lc code=start
class Solution {
public:
int networkDelayTime(vector<vector<int>>& times, int n, int k) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=745 lang=cpp
*
* [745] å‰ç¼€å’ŒåŽç¼€æœç´¢
*/
// @lc code=start
#define TRIEN 29
int mydata[2500*TRIEN]={0},cnt;
class WordFilter {
void reset(){
memset(mydata,0,sizeof(mydata));
cnt=1;
}
int* operator[](int i){
return mydata+i*TRIEN;
}
void in... |
/*
* @lc app=leetcode.cn id=746 lang=cpp
*
* [746] 使用最å°èŠ±è´¹çˆ¬æ¥¼æ¢¯
*/
// @lc code=start
class Solution {
public:
int minCostClimbingStairs(vector<int>& cost) {
int n = cost.size();
int f[n];
f[0] = cost[0];
f[1] = cost[1];
for(int i=2; i<n; i++){
/... |
/*
* @lc app=leetcode.cn id=752 lang=cpp
*
* [752] 打开转盘é”
*/
// @lc code=start
class Solution {
public:
int string2int(string& s) {
int res = 0;
for(auto& c : s) {
res *= 10;
res += c - '0';
}
return res;
}
int openLock(vector<string>& dea... |
/*
* @lc app=leetcode.cn id=76 lang=cpp
*
* [76] 最å°è¦†ç›–å串
*/
// @lc code=start
class Solution {
public:
string minWindow(string s, string t) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=761 lang=cpp
*
* [761] 特殊的二进制åºåˆ—
*/
// @lc code=start
class Solution {
public:
string makeLargestSpecial(string s) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=767 lang=cpp
*
* [767] 釿ž„å—符串
*/
// @lc code=start
class Solution {
public:
string reorganizeString(string S) {
if (S.length() < 2) {
return S;
}
vector<int> counts(26, 0);
int maxCount = 0;
int length = S.length();
... |
/*
* @lc app=leetcode.cn id=770 lang=cpp
*
* [770] 基本计算器 IV
*/
// @lc code=start
class Solution {
public:
vector<string> basicCalculatorIV(string expression, vector<string>& evalvars, vector<int>& evalints) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=778 lang=cpp
*
* [778] æ°´ä½ä¸Šå‡çš„æ³³æ± 䏿¸¸æ³³
*/
// @lc code=start
class Solution {
public:
int swimInWater(vector<vector<int>>& grid) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=783 lang=cpp
*
* [783] äºŒå‰æœç´¢æ ‘节点最å°è·ç¦»
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : v... |
/*
* @lc app=leetcode.cn id=786 lang=cpp
*
* [786] 第 K 个最å°çš„ç´ æ•°åˆ†æ•°
*/
// @lc code=start
class Solution {
public:
vector<int> kthSmallestPrimeFraction(vector<int>& arr, int k) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=787 lang=cpp
*
* [787] K ç«™ä¸è½¬å†…最便宜的航ç
*/
// @lc code=start
class Solution {
public:
int findCheapestPrice(int n, vector<vector<int>>& flights, int src, int dst, int K) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=790 lang=cpp
*
* [790] 多米诺和托米诺平铺
*/
// @lc code=start
class Solution {
public:
int numTilings(int N) {
long long f[N+1][2];
memset(f, 0, sizeof(f));
f[0][0] = 1;
f[1][0] = 1;
f[1][1] = 2;
long long m = 1e9+7;
... |
/*
* @lc app=leetcode.cn id=8 lang=cpp
*
* [8] å—ç¬¦ä¸²è½¬æ¢æ•´æ•° (atoi)
*/
// @lc code=start
class Solution {
public:
int myAtoi(string s) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=817 lang=cpp
*
* [817] 链表组件
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
// 唯一值,链表的值是å¦åœ¨Gä¸ï¼Œ... |
/*
* @lc app=leetcode.cn id=818 lang=cpp
*
* [818] 赛车
*/
// @lc code=start
class Solution {
public:
int racecar(int target) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=82 lang=cpp
*
* [82] åˆ é™¤æŽ’åºé“¾è¡¨ä¸çš„é‡å¤å…ƒç´ II
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* List... |
/*
* @lc app=leetcode.cn id=83 lang=cpp
*
* [83] åˆ é™¤æŽ’åºé“¾è¡¨ä¸é‡å¤çš„å…ƒç´
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNod... |
/*
* @lc app=leetcode.cn id=84 lang=cpp
*
* [84] æŸ±çŠ¶å›¾ä¸æœ€å¤§çš„矩形
*/
// @lc code=start
class Solution {
public:
int largestRectangleArea(vector<int>& heights) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=846 lang=cpp
*
* [846] 一手顺å
*/
// @lc code=start
class Solution {
public:
bool isNStraightHand(vector<int>& hand, int W) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=85 lang=cpp
*
* [85] 最大矩形
*/
// @lc code=start
class Solution {
public:
int maximalRectangle(vector<vector<char>>& matrix) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=850 lang=cpp
*
* [850] 矩形é¢ç§¯ II
*/
// @lc code=start
class Solution {
public:
int rectangleArea(vector<vector<int>>& rectangles) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=855 lang=cpp
*
* [855] 考场就座
*/
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
using namespace std;
// @lc code=start
class ExamRoom {
private:
int n;
set<int> s;
public:
ExamRoom(int N) {
n... |
/*
* @lc app=leetcode.cn id=856 lang=cpp
*
* [856] 括å·çš„分数
*/
// @lc code=start
class Solution {
public:
int scoreOfParentheses(string S) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=857 lang=cpp
*
* [857] 雇佣 K åå·¥äººçš„æœ€ä½Žæˆæœ¬
*/
// @lc code=start
class Solution {
public:
double mincostToHireWorkers(vector<int>& quality, vector<int>& wage, int K)
{
vector<pair<double, int>> x;
int N = quality.size();
for (int i = 0; i < N; i... |
/*
* @lc app=leetcode.cn id=86 lang=cpp
*
* [86] 分隔链表
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *ne... |
/*
* @lc app=leetcode.cn id=864 lang=cpp
*
* [864] èŽ·å–æ‰€æœ‰é’¥åŒ™çš„æœ€çŸè·¯å¾„
*/
// @lc code=start
class Solution {
public:
int shortestPathAllKeys(vector<string>& grid) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=87 lang=cpp
*
* [87] 扰乱å—符串
*/
// @lc code=start
class Solution {
public:
bool isScramble(string s1, string s2) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=871 lang=cpp
*
* [871] æœ€ä½ŽåŠ æ²¹æ¬¡æ•°
*/
// @lc code=start
class Solution {
public:
int minRefuelStops(int target, int startFuel, vector<vector<int>>& stations) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=876 lang=cpp
*
* [876] 链表的ä¸é—´ç»“点
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* middleNode(ListNode* h... |
/*
* @lc app=leetcode.cn id=880 lang=cpp
*
* [880] 索引处的解ç å—符串
*/
// @lc code=start
class Solution {
public:
string decodeAtIndex(string S, int K) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=882 lang=cpp
*
* [882] 细分图ä¸çš„å¯åˆ°è¾¾ç»“点
*/
// @lc code=start
class Solution {
public:
int reachableNodes(vector<vector<int>>& edges, int maxMoves, int n) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=892 lang=cpp
*
* [892] 三维形体的表é¢ç§¯
*/
// @lc code=start
class Solution {
public:
int surfaceArea(vector<vector<int>>& grid) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=895 lang=cpp
*
* [895] æœ€å¤§é¢‘çŽ‡æ ˆ
*/
// @lc code=start
class FreqStack {
public:
FreqStack() {
}
void push(int val) {
}
int pop() {
}
};
/**
* Your FreqStack object will be instantiated and called as such:
* FreqStack* obj = new FreqStack();
... |
/*
* @lc app=leetcode.cn id=899 lang=cpp
*
* [899] 有åºé˜Ÿåˆ—
*/
// @lc code=start
class Solution {
public:
string orderlyQueue(string s, int k) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=901 lang=cpp
*
* [901] è‚¡ç¥¨ä»·æ ¼è·¨åº¦
*/
// @lc code=start
class StockSpanner {
public:
StockSpanner() {
}
int next(int price) {
}
};
/**
* Your StockSpanner object will be instantiated and called as such:
* StockSpanner* obj = new StockSpanner();
* int pa... |
/*
* @lc app=leetcode.cn id=907 lang=cpp
*
* [907] åæ•°ç»„的最å°å€¼ä¹‹å’Œ
*/
// @lc code=start
class Solution {
public:
int sumSubarrayMins(vector<int>& arr) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=91 lang=cpp
* 1210340156
*
* [91] è§£ç æ–¹æ³•
*/
#include <string>
using namespace std;
// @lc code=start
class Solution {
public:
int numDecodings(string s) {
int n = s.length();
if(n == 0) return 0;
int f[n+1];
f[0] = 1;
f[1] = s[0] == '0'... |
/*
* @lc app=leetcode.cn id=92 lang=cpp
*
* [92] å转链表 II
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *n... |
/*
* @lc app=leetcode.cn id=921 lang=cpp
*
* [921] ä½¿æ‹¬å·æœ‰æ•ˆçš„æœ€å°‘æ·»åŠ
*/
// @lc code=start
class Solution {
public:
int minAddToMakeValid(string S) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=931 lang=cpp
*
* [931] 下é™è·¯å¾„最å°å’Œ
*/
// @lc code=start
class Solution {
public:
int minFallingPathSum(vector<vector<int>>& g) {
int n=g.size();
int f[n][n];
int m = INT_MAX;
for(int j=0; j<n; j++){
f[0][j]=g[0][j];
}
... |
/*
* @lc app=leetcode.cn id=932 lang=cpp
*
* [932] 漂亮数组
*/
// @lc code=start
class Solution {
public:
vector<int> beautifulArray(int n) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=933 lang=cpp
*
* [933] 最近的请求次数
*/
#include<queue>
using namespace std;
// @lc code=start
class RecentCounter {
public:
queue<int> q;
RecentCounter() {
}
int ping(int t) {
q.push(t);
// å–出超过3000的数值,åªä¿ç•™3000以内的
... |
/*
* @lc app=leetcode.cn id=935 lang=cpp
*
* [935] 骑士拨å·å™¨
*/
// @lc code=start
class Solution {
public:
int knightDialer(int N) {
int steps[N + 1][10];
int mod = 1000000007;
for(int i = 0; i < 10; i ++) {
steps[1][i] = 1;
}
// æ¯ä¸€æ¥éƒ½ä¾èµ–å‰ä¸€æ¥... |
/*
* @lc app=leetcode.cn id=936 lang=cpp
*
* [936] 戳å°åºåˆ—
*/
// @lc code=start
class Solution {
public:
vector<int> movesToStamp(string stamp, string target) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=94 lang=cpp
*
* [94] äºŒå‰æ ‘çš„ä¸åºé历
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left... |
/*
* @lc app=leetcode.cn id=944 lang=cpp
*
* [944] åˆ åˆ—é€ åº
*/
// @lc code=start
class Solution {
public:
int minDeletionSize(vector<string>& strs) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=946 lang=cpp
*
* [946] éªŒè¯æ ˆåºåˆ—
*/
// @lc code=start
class Solution {
public:
bool validateStackSequences(vector<int>& pushed, vector<int>& popped) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=95 lang=cpp
*
* [95] ä¸åŒçš„äºŒå‰æœç´¢æ ‘ II
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), l... |
/*
* @lc app=leetcode.cn id=96 lang=cpp
*
* [96] ä¸åŒçš„äºŒå‰æœç´¢æ ‘
*/
// @lc code=start
class Solution {
public:
int numTrees(int n) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=963 lang=cpp
*
* [963] 最å°é¢ç§¯çŸ©å½¢ II
*/
// @lc code=start
class Solution {
public:
double minAreaFreeRect(vector<vector<int>>& points) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=968 lang=cpp
*
* [968] ç›‘æŽ§äºŒå‰æ ‘
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int... |
/*
* @lc app=leetcode.cn id=973 lang=cpp
*
* [973] 最接近原点的 K 个点
*/
#include <queue>
using namespace std;
// @lc code=start
class Solution {
public:
struct Node{
vector<int> points;
int value;
};
vector<vector<int>> kClosest(vector<vector<int>>& points, int k) {
a... |
/*
* @lc app=leetcode.cn id=975 lang=cpp
*
* [975] 奇å¶è·³
*/
// @lc code=start
class Solution {
public:
int oddEvenJumps(vector<int>& arr) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=978 lang=cpp
*
* [978] æœ€é•¿æ¹æµå数组
*/
// @lc code=start
class Solution {
public:
int maxTurbulenceSize(vector<int>& arr) {
}
};
// @lc code=end
|
/*
* @lc app=leetcode.cn id=98 lang=cpp
*
* [98] 验è¯äºŒå‰æœç´¢æ ‘
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(n... |
/*
* @lc app=leetcode.cn id=987 lang=cpp
*
* [987] äºŒå‰æ ‘的垂åºé历
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), le... |
/*
* @lc app=leetcode.cn id=99 lang=cpp
*
* [99] æ¢å¤äºŒå‰æœç´¢æ ‘
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nu... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* 2-DIMENSIONAL ARRAY
*
* Simulated by 1-dimension array.
****************... |
/*******************************************************************************
* DANIEL'1'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
* 8-Queue
*
* http://en.wikipedia.org/wiki/Eight_queens_puzzle
***********... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* A* ALGORITHM
*
* Features:
* In computer science, A* (pronounced "A ... |
/*******************************************************************************
* ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* Adelson-Velskii and Landis' (AVL) tree
*
* Features, being N the number of element... |
/*******************************************************************************
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* Base64
* Base64 is a group of similar binary-to-text encoding schemes that represent
* binary data in an ASC... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* BELLMAN-FORD ALGORITHM
*
* The Bellman–Ford algorithm computes single... |
/*******************************************************************************
* ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* BINARY SEARCH TREE
*
* Features:
* 1. Expected search time is O(log(n)), with wor... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* BIT-SET
*
* a bit-set data structure
*
********************************... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* BLOOM FILTER
*
* Features:
* A Bloom filter with 1% error and an optim... |
/*******************************************************************************
* ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* B-TREE
*
* In computer science, a B-tree is a tree data structure that keeps data ... |
/*******************************************************************************
* ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* BUBBLE SORT
*
* Bubble sort, sometimes incorrectly referred to as sinking sort, ... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* .Net Dictionary Implementation (Cache friendly hash table)
*
********************************************... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* DIJKSTRA ALGORITHM
*
* Features:
*
* Dijkstra's algorithm, conceive... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* DIRECTED GRAPH
*
* Features:
* 1. Adjacency List Implementation
*
* h... |
/*******************************************************************************
* ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* Disjoint-set data structure
*
* In computing, a disjoint-set data structure is a... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* DYNAMIC ORDER STATISTIC
*
* Features:
* 1. based on red-black tree
* 2.... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* DOUBLE LINKED-LIST FROM LINUX KERNEL
*
* Features:
* 1. clean
* 2. data... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* EDMONS-KARP ALGORITM
*
* Features:
* In computer science and graph the... |
/*******************************************************************************
* Fenwick Tree
*
* Data structure providing prefix sums and modify the table in O(log n) - n is the size o the table.
*
* In this algorithm we use two functions:
* - RSQ - This function calculates the range sum query in O(log n)
* -... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* FIBONACCI HEAP
*
* In computer science, a Fibonacci heap is a heap data s... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* GENERIC METHODS FOR ALGORITHMS
*
****************************************... |
#ifndef ALGO_GRAPH_DEFS_H__
#define ALGO_GRAPH_DEFS_H__
#include "double_linked_list.h"
namespace alg {
/**
* Graph definition
*/
class Graph {
public:
/**
* the connected Vertex
*/
struct Vertex {
uint32_t id;
int32_t weight;
struct list_head v_node;
Vertex(uint32_t vid) {
... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* BREADTH FIRST SEARCH
*
* Features:
* In graph theory, breadth-first se... |
#ifndef ALGO_HASH_CODE_H__
#define ALGO_HASH_CODE_H__
#include <string.h>
#include "hash_string.h"
namespace alg {
/**
* default compare funcs
*/
template<typename T>
struct hash_code {
uint32_t operator()(T) {
printf("must provide a hash function for _Key\n");
return 0;
}
};
template<>
struct has... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* HASH BY MULTIPLICATION
*
* Features:
* 1. h(k) = (A*k mod 2^w) >> (w-r... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* STRING HASH FUNCTIONS
*
* 1. http://en.wikipedia.org/wiki/Java_hashCode()... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* GENERIC HASH TABLE
*
* Features:
* 1. separate chaining for resolving c... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* Heap Data structure
*
* In computer science, a heap is a specialized tree... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* HUFFMAN CODING
*
* Features:
* In computer science and information t... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* COMMON MATH OPS
*
*******************************************************... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* INSERTION SORT
*
* 1. sort array in O(n^2) time.
*
* http://en.wikip... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* INTEGER -- OF ARBITARY LENGTH
*
* Retrieved from:
* http://en.literatep... |
/*******************************************************************************
* DANIEL'S ALGORITHM IMPLEMENTAIONS
*
* /\ | _ _ ._ o _|_ |_ ._ _ _
* /--\ | (_| (_) | | |_ | | | | | _>
* _|
*
* INTERVAL-TREE
*
* Features:
* 1. red-black tree based
* 2. O(logn) look... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.