- 博客(15)
- 资源 (10)
- 收藏
- 关注
原创 [算法]字符串匹配算法KMP(java)
public class KMP { public static void cal_next(String str,int[] next,int len){ int i, j; next[0] = -1; for( i = 1; i < len; i++ ) { j = next[ i - 1 ];
2017-01-16 10:56:25 307
原创 [算法] 最长公共子序列(LCS)问题
最近刚刚结束了算法分析课程,并结束了考试,败在了最长公共子序列 的问题上,非常懊悔,于是把最长公共子序列问题拿出来再次学习。一、什么是最长公共子序列什么是最长公共子序列呢?举个简单的例子吧,一个数列S,若分别是两个或多个已知序列的子序列,且是所有符合条件序列中最长的,则S称为已知序列的最长公共子序列。举例如下,如:有两个随机数列,1 2 3 4 5 6 和 3 4 5 8 9,则它们的最长公共子序列
2017-01-14 20:46:07 1751
原创 [leetcode]21. Merge Two Sorted Lists(java)
题目描述: 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-01-09 22:41:27 464
原创 [leetcode]88. Merge Sorted Array (java)
题目描述: 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. 解题思路: 这是一道数组操作的题目,思路比较明确,就是维护三个数组,分别对应数组A,数组B,和结果数
2017-01-09 19:03:01 492
原创 [leetcode]38. Count and Say(java)
题目描述: The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, … 1 is read off as “one 1” or 11. 11 is read off as “two 1s” or 21. 21 is read
2017-01-09 14:19:02 698
转载 [leetcode]6. ZigZag Conversion
这个题我本人没想出来,所以参考了csdn大神的博客 本文转自:http://blog.csdn.net/zhouworld16/article/details/14121477 题目要求:The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may
2017-01-08 21:30:03 259
原创 [leetcode]206. Reverse Linked List
题目描述: Reverse a singly linked list. 解题思路:这个题有两种思路:递归和迭代,迭代相对于递归方式更加直观。 引入:算法中的自顶向下和自底向上 动态规划的实现分为两种,有递归和迭代。 递归一般是自顶向下,依赖于子问题优化函数的结果,只有子问题完全求出,也就是子问题的递归返回结果,原问题才能求解。 迭代法,就是巧妙的安排求解顺序,从最小的子
2017-01-08 11:03:11 276
转载 [Java]Error:No enclosing instance of type E is accessible. Must qualify the allocation with an enclo
在自己试着写一个链表的例子时,由于参考的代码只有一部分,于是就自己补了一个内部类。结果编译时出现:No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing instance of type E(e.g. x.new A() where x is an instance o
2017-01-08 10:56:19 360
原创 [python]tree auto generator
from leetcode discussI wrote a tree auto generator:import random class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = Nonedef generateCh
2017-01-07 19:54:20 392
原创 [leetcode]83. Remove Duplicates from Sorted List(java)
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. 解题思路: 设置两个指针一个no
2017-01-07 11:38:24 304
原创 [leetcode]26. Remove Duplicates from Sorted Array(java)
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in place with
2017-01-06 22:49:02 321
原创 [leetcode]24. Swap Nodes in Pairs(java)
Given a linked list, swap every two adjacent nodes and return its head.For example, Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. You may no
2017-01-06 21:22:06 336
原创 [leetcode]20. Valid Parentheses(java)
问题形容: 题目:有效括号 description: Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid. The brackets must close in the correct orde
2017-01-06 13:47:54 389
原创 [数据结构]java实现的简单链表的 头/尾插法
尾插法:package structure; import java.io.*; import java.util.*;class Node { int data; Node next; Node(int d) { data = d; next = null; } } public class Test3 { public sta
2017-01-02 14:08:29 6726
转载 [Java] Java关键字final、static使用总结
Java关键字final、static使用总结转自:http://lavasoft.blog.51cto.com/62575/18771/一、final 根据程序上下文环境,Java关键字final有“这是无法改变的”或者“终态的”含义,它可以修饰非抽象类、非抽象类成员方法和变量。你可能出于两种理解而需要阻止改变:设计或效率。 final类不能被继承,没有子类,final类中的方法默认
2017-01-01 11:09:03 278
labelme批量转换工具.rar
2019-10-21
ssh(struts2+spring4+hibernate4)简单整合
2016-12-03
spring+springmvc+mybatis实例
2016-11-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人