c++
文章平均质量分 75
A_bigUncle
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Huffman Tree
Huffman Tree标签(空格分隔): 算法、HuffmanHuffman Tree & Huffman CodingGiven a sequence of weight, then build a Huffman Tree with this sequence. Or Given a sequence of string(only from ‘a’ to ‘z’), then build a原创 2017-05-24 21:30:43 · 666 阅读 · 0 评论 -
[Week 14] LeetCode 23. Merge k Sorted Lists
LeetCode 23. Merge k Sorted Lists问题描述Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.ExampleInput:[ 1->4->5, 1->3->4, 2->6]...原创 2018-12-09 18:42:27 · 245 阅读 · 0 评论 -
[Week 13] LeetCode 338. Counting Bits
LeetCode 338. Counting Bits问题描述Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and return them as an ...原创 2018-12-02 19:33:17 · 298 阅读 · 0 评论 -
[Week 11] LeetCode 403. Frog Jump
LeetCode 403. Frog Jump问题描述A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not jump into ...原创 2018-11-18 18:46:32 · 437 阅读 · 0 评论 -
[Week 9] LeetCode 72. Edit Distance
LeetCode 72. Edit Distance问题描述Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2.You have the following 3 operations permitted on a word:Ins...原创 2018-11-04 17:01:48 · 243 阅读 · 0 评论 -
[Week 10] LeetCode 32. Longest Valid Parentheses
LeetCode 32. Longest Valid Parentheses问题描述Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.示例Example 1Input: "((...原创 2018-11-09 20:04:44 · 248 阅读 · 0 评论 -
[Week 8] LeetCode 300. Longest Increasing Subsequence
LeetCode 300. Longest Increasing Subsequence问题描述Given an unsorted array of integers, find the length of longest increasing subsequence.ExampleInput: [10,9,2,5,3,7,101,18]Output: 4 Explanation: T...原创 2018-10-28 17:14:05 · 315 阅读 · 0 评论 -
[Week 7] LeetCode 45 & 55. Jump Game I & II
LeetCode 45 & 55. Jump Game I & IIJump Game IGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your ...原创 2018-10-20 18:33:34 · 310 阅读 · 0 评论 -
[Week 6] LeetCode 4. Median of Two Sorted Arrays
LeetCode 4. Median of Two Sorted Arrays问题描述There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should ...原创 2018-10-14 16:47:47 · 237 阅读 · 0 评论 -
[Week 5] LeetCode 854. K-Similar Strings
LeetCode 854. K-Similar Strings问题描述:Strings A and B are K-similar (for some non-negative integer K) if we can swap the positions of two letters in A exactly K times so that the resulting string equa...原创 2018-10-07 19:26:00 · 574 阅读 · 0 评论 -
[Week 4] LeetCode 743. Network Delay Time
LeetCode 743. Network Delay Time问题描述:There are N network nodes, labelled 1 to N.Given times, a list of travel times as directed edges times[i] = (u, v, w), where u is the source node, v is the targ...原创 2018-09-28 15:39:08 · 342 阅读 · 0 评论 -
[Week 3] LeetCode 785. Is Graph Bipartite?
LeetCode 785. Is Graph Bipartite?问题描述:Given an undirected graph, return true if and only if it is bipartite.Recall that a graph is bipartite if we can split it’s set of nodes into two independent s...原创 2018-09-22 10:12:11 · 305 阅读 · 0 评论 -
[Week 1] LeetCode 215. Kth Largest Element in an Array
LeetCode 215. Kth Largest Element in an Array问题描述:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.输入示...原创 2018-09-08 22:19:20 · 239 阅读 · 0 评论 -
Prim算法最小生成树c++实现
Prim算法最小生成树c++实现标签(空格分隔): Prim 算法 c++最近离散课上讲到了Prim算法实现最小生成树,现在用c++来实现。本文代码来源于乔帮主伪代码。简述对于给定的带权图G,为了使得生成树T的权w(T)最小,我们可以使用贪心算法。求最小生成树的贪心法:1.选择一个初始点v1v_1; 2.为了使得生成树的权极小化,选择v1v_1的最小权邻点,并将其连接到v1v_1; 3.选择{v原创 2017-05-17 23:51:34 · 2500 阅读 · 0 评论 -
链表实现大数加法
链表实现大数加法标签: 算法Description你的任务是完成一条能实现加法功能的单向链表,需要实现的函数在头文件已给出。 假如现在有 123 与 234 两个数字,那么他们在链表中的存储结构将会是 : 3->2->1与 4->3->2 注意到这里的链表只允许从前端插入,你也可以把这个特殊的链表当做栈来处理。 输入的数字不会有负数且不会有前导0的输入。也就是说,输入的数字中不会出现0,更不会原创 2017-05-16 21:12:35 · 4942 阅读 · 0 评论 -
Vector
关于Vectorvector(向量):c++中的一种数据结构,确切的说 是一个类。它相当于一个动态的数组,当程序员无法知道自己需要多大的数组的规模是,用其来解决问题可以达到最大节约空间的目的。用法0.文件包含:· 程序开头加上 #include <vector>以包含所需要的类文件vector。1.变量声明:1.1: std::vertor<type> a;等于声明了一个(type)类型的没有指定原创 2017-03-11 08:14:48 · 477 阅读 · 0 评论 -
Capacity Facility Location Problem
文章目录Capacity Facility Location ProblemCFLP方案贪心算法局部搜索法模拟退火效果代码贪心算法局部搜索模拟退火目前最优解Capacity Facility Location ProblemCFLPCapacity Facility Location Problem,即有容量限制的设施选址问题,更准确地说,这次解决的问题为 SSCFLP(Single Sou...原创 2018-12-23 09:47:24 · 2211 阅读 · 0 评论
分享