- 博客(21)
- 资源 (1)
- 收藏
- 关注
原创 常用排序算法--冒泡,插入,选择,希尔,归并,快速
因为之前看一道题目的时候用到了排序算法,所以就想在总结一下这几个常用算法的思想和实现方法。 在写之前先来看一下各种方法的效率比较。1,冒泡排序法,因为代码注释比较详细,不在多说。主要是相邻元素之间比较然后交换。有两种改进思路也进行了实现。/** * 冒泡排序 * 比较相邻的元素。如果第一个比第二个大,就交换他们两个。 * 对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对。在这一点,
2017-06-28 18:58:32 1112 3
原创 leetcode题解-61. Rotate List
61,题目:Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.本题是将链表在某处进行翻转,但问题是k值可能比链表总长度还要大,这就会带来一
2017-06-27 21:43:50 900
原创 leetcode题解-21. Merge Two Sorted Lists
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.合并链表,很简单的题目。这里提供两种解法,一是循环一个是递归,貌似所有的链表的题目都可以用这两种方法解决== 先
2017-06-25 13:13:03 1102
原创 leetcode题解-234. Palindrome Linked List
Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?题目是想要判断一个链表的值是否满足回文条件。要求使用O(1)的空间复杂度可能是本题的难点。这就要求我们不能使用别得数据结构对链表的值进行保存在判断。所以我一开始就想能否使用
2017-06-24 09:44:35 1067
原创 Tensorflow中使用TFRecords高效读取数据--结合NLP数据实践
之前一篇博客在进行论文仿真的时候用到了TFRecords进行数据的读取操作,但是因为当时比较忙,所以没有进行深入学习。这两天看了一下,决定写篇博客专门结合该代码记录一下TFRecords的相关操作。 首先说一下为什么要使用TFRecords来进行文件的读写,在TF中数据的传入方式主要包含以下几种:供给数据(Feeding): 在TensorFlow程序运行的每一步, 让Python代码来供给数据
2017-06-23 20:15:20 14505 6
原创 leetcode题解-206. Reverse Linked List
题目:Reverse a singly linked list.click to show more hints.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?本题就是将链表翻转,按照提示可以根据循环和递归两种方式进行,比较简单不做过多解释,直接上代码:
2017-06-23 09:48:51 1204
原创 Hierarchical Attention Network for Document Classification阅读笔记
最近看了”Hierarchical Attention Network for Document Classification”一篇文章,也在网上找了一些资料结合理解,发现在此之前有篇文章跟他提出的模型架构基本相似,只不过不包含attention机制:“Document Modeling with Gated Recurrent Neural Network for Sentiment Class
2017-06-22 21:06:43 16025 5
原创 leetcode题解-203. Remove Linked List Elements
题目:Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5本题是删除链表中指定值的元素,在这里总结一下链表删除操作的方法:
2017-06-22 19:08:54 1364
原创 leetcode题解-160. Intersection of Two Linked Lists
题目:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘
2017-06-21 22:05:50 1614
原创 leetcode题解-83. Remove Duplicates from Sorted List
题目:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.本题是给定了一个排序链表,然后删除其中重复的元素,因为已经排好
2017-06-21 09:48:35 618
原创 leetcode题解-141. Linked List Cycle
题目:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?上午终于把数组的题目全部都刷完了,接下来开始看链表的题目。第一道题很简单,就是判断一个链表中是否存在环。我们知道,如果一个链表中没有环,那么我们在遍历的过程中最后一个元素会指向空
2017-06-20 21:13:39 2925 1
原创 leetcode题解-126. Word Ladder II
题目:Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:Only one letter can be changed at a timeEach
2017-06-20 10:42:34 3243
原创 leetcode题解-128. Longest Consecutive Sequence
题目:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1, 2, 3, 4]
2017-06-17 21:30:13 1385
原创 leetcode题解-123. Best Time to Buy and Sell Stock III
题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete at most two transactions.Note:You may not eng
2017-06-15 09:52:42 4291
原创 leetcode题解-41. First Missing Positive
题目:Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses constant space.这
2017-06-14 09:34:20 901
原创 leetcode题解-84. Largest Rectangle in Histogram
题目:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each
2017-06-12 11:11:57 1096
原创 leetcode题解-57. Insert Interval
题目:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times.Example
2017-06-10 14:01:47 688
原创 leetcode题解-45. Jump Game II
题目:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Your goal is to r
2017-06-09 10:56:01 920
原创 leetcode题解-42. Trapping Rain Water
题目:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1], r
2017-06-07 15:15:25 1077
原创 阅读理解任务中的Attention-over-Attention神经网络模型原理及实现
本文是“Attention-over-Attention Neural Networks for Reading Comprehension”的阅读笔记。这篇论文所处理的任务是阅读理解里面的完形填空问题。其模型架构是建立在“Text Understanding with the Attention Sum Reader Network”这篇论文至上。该论文首先提出了将Attention用于完形填空任
2017-06-06 09:24:00 9459 1
原创 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 be O(log (m+n)).Example 1:nums1 = [1, 3]nu
2017-06-02 10:32:13 843
echarts地图等相关js文件 源码下载
2017-10-16
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人