LeetCode与数据结构
gaussrieman123
喜欢新技术与老故事。
展开
-
Matlab实现Huffman编码
代码function [ u, c, e, f] = huff_codec( A )%HUFF_CODEC 哈夫曼编码的MATLAB实现% author==Frank% 本程序重点在建树和建表过程,以及求解平均码长和编码效率% 因为建表的顺序不一致,可能会导致码表不一致,但是都满足熵编码要求%u 输出排序后的频率分布%c 输出码表%e 输出平均码长%f原创 2017-03-29 10:07:06 · 27728 阅读 · 11 评论 -
LeetCode算法第二题 "add two sums"
DescriptionYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers an原创 2017-11-09 16:10:28 · 279 阅读 · 0 评论 -
LeetCode算法第三题
DescriptionGiven a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb“==, the answer is “abc“, which the length is 3.Given “bbbbb“, the answer is “b“原创 2017-11-10 15:12:31 · 282 阅读 · 0 评论 -
LeetCode 算法第四题
DescriptionThere 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 be O(log (m+n)).原创 2017-11-14 10:36:40 · 335 阅读 · 0 评论 -
LeetCode 5. Longest Palindromic Substring
DescriptionGiven a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.原创 2017-11-15 14:03:02 · 232 阅读 · 0 评论