自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(34)
  • 资源 (2)
  • 收藏
  • 关注

原创 Spring 松耦合实例

假定我们现在需要输出不同格式文件,传统实现方式如下:1 创建输出文件接口IGenerateFile.javapackage com.xidian.edu;public interface IGenerateFile { public void generateFile();}2 创建TxtGenerateFile.java、XmlGenerateFile.java实现IG

2017-10-20 16:48:55 1036

原创 JAVA Spring HelloWord实现

IDE:IntelliJ IDEA 2017HelloWord.javapackage com.xidian.edu;public class HelloWorld { private String name; public void setName(String name){ this.name=name; } public void

2017-10-19 15:46:00 433

原创 LeetCode算法题——27. Remove Element

题目:Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant me

2017-05-05 22:33:40 339

原创 LeetCode算法题——26. Remove Duplicates from Sorted Array

题目: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 p

2017-05-05 22:20:49 351

原创 LeetCode算法题——25. Reverse Nodes in k-Group

题目:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the

2017-05-05 21:43:34 298

原创 LeetCode算法题——24. Swap Nodes in Pairs

题目: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

2017-05-05 17:08:00 376

原创 LeetCode算法题——23. Merge k Sorted Lists

题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Subscribe to see which companies asked this question.算法思想:     针对K个排序的链表进行两

2017-05-04 20:24:22 339

原创 LeetCode算法题——22. Generate Parentheses

题目:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[  "((()))",  "(()())",  "(())

2017-04-22 21:11:26 308

原创 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-04-12 17:01:42 376

原创 LeetCode算法题——20. Valid Parentheses

题目Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are

2017-04-11 21:47:39 305

原创 LeetCode算法题——17. Letter Combinations of a Phone Number

题目Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:

2017-04-11 20:53:37 288

原创 LeetCode算法题——19. Remove Nth Node From End of List

题目Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the

2017-03-26 21:28:16 387

原创 LeetCode算法题——18. 4Sum

题目:Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The s

2017-03-26 14:45:27 348

原创 LeetCode算法题——16. 3Sum Closest

题目:Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have

2017-03-24 16:21:03 280

原创 LeetCode算法题——15. 3Sum

题目:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solution set must not

2017-03-24 15:11:38 338

原创 LeetCode算法题——14. Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.算法思想:逐个比对每个字符串的前缀字符,若出现不相等或者其中某个字符已经是最末尾的字符时,跳出循环。C++实现如下:#include #include using namespace std;class

2017-03-21 17:12:46 236

原创 LeetCode算法题——13. Roman to Integer

Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.针对罗马字符出现的每个位上所有情况考虑进去,得到相应整形数字class Solution {public:    int romanToInt(string

2017-03-21 17:11:27 271

原创 LeetCode算法题——12. Integer to Roman

Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.求出所给数字的个、十、百、千位上的数字,然后对应到相应罗马数字字符class Solution {public:    string intToRoman(

2017-03-21 17:10:34 314

原创 LeetCode算法题——11. Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find

2017-03-17 12:11:30 276

原创 Python面向对象编程(5)——类的特殊方法

类的特殊方法1 深入理解类     类本质上也是一个对象,只是其拥有创建自身实例的能力     类可以与变量进行绑定,并且可以为类增加属性     可以把类作为函数的参数传递2 元类     类的创建和管理者(type),所有的类都是元类的实例isinstance(Empty,type)查看Empty是否是type的实例类实例化过程:__new__()、__

2017-03-12 17:06:23 439

原创 LeetCode算法题——Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting th

2017-03-12 15:25:23 246

原创 LeetCode算法题——String to Integer (atoi)

Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca

2017-03-10 15:38:07 276

原创 LeetCode算法题——Reverse Integer

Description:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions

2017-03-10 11:18:00 204

原创 LeetCode算法题——Add Two Numbers

Description:You 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 number

2017-03-09 21:49:24 249

原创 LeetCode算法题——ZigZag Conversion

Description:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A

2017-03-09 21:46:30 313

原创 Python面向对象编程(4)——类的继承与方法重载

类的继承与方法重载1 继承的特点     减少代码并且灵活的定制新类,子类可以继承父类的属性和方法,但另一方面子类无法继承父类的私有属性和私有方法,子类可以修改父类的方法,也可以定义新的方法。2 继承的语法定义     方式:在类名之后添加(继承的父类)     多重继承时,括号中放入多个父类名     示例:class myclass(baseclass)     重

2017-03-05 22:10:12 2482 1

原创 Python面向对象编程(3)——类方法、静态方法

类方法、静态方法1 静态方法     定义形式:@staticmethod装饰,参数不需要self          静态方法无法引用或访问实例属性,可通过类.类变量访问类属性     可以采用类、类实例进行调用     与类相关,但不依赖和改变类和实例     类相关工具方法放在其中,使函数归于类,便于代码的管理classStaticMethodDemo:

2017-03-05 21:03:26 395

原创 Python面向对象编程(2)——深入类的属性

2 深入类的属性2.1 同名的类属性与实例属性     在使用实例名.属性名应用时,优先引用实例属性     使用类名.属性名时,只能引用类属性classClassAttrDemo1:    a=10   def__init__(self):       self.a=20       self.b=20   cad1=ClassAttr

2017-03-04 16:15:03 328

原创 Python面向对象编程(1)——属性分类、方法调用

1 面向对象编程     1.1 面向对象编程优点:封装、继承、多态、组合     1.2 类说明采用"""三引号,可用类名.__doc__或者help(类名)查看类说明     1.3 描述对象的特征     1.3.1 实例属性classClassDemo2:   def__init__(self):       self.a=10

2017-03-04 15:48:46 1037

原创 Python基础语法(4)——GUI编程及猜数字游戏

13 图形界面(GUI)及猜数字游戏1 GUI:Graphical User Interface2 tkinter:GUI library for Python3 GUI Example13.1 图形界面fromtkinterimport*importtkinter.messageboxasmbimporttkinter.simpledial

2017-03-04 15:46:29 1339

原创 Python基础语法(3)——文件流、异常处理、面向对象编程以及装饰器

10 输入输出10.1 输入输出方式介绍     可采用input方式接收控制台的输入str1=input("Please input a string:")print(str1)print("{}".format(str1))10.2 IO文件流写文件# -*- coding=utf-8 -*-textContext='''\Cre

2017-03-04 15:40:26 562

原创 Python基础语法(2)——字典、函数定义使用、控制流(if&for&while)

7.3 字典Dictionary(键值对)     创建字典:demoDic={"name":"Tom","age":10,"sex":1}     查看key对应的Value值:demoDic["name"]     删除字典中元素:deldemoDic["name"]     清空字典:demoDic.clear()     向字典中插入新的元素:demoDic["sc

2017-03-04 14:53:19 468

原创 Python基础语法(1)—— 输入输出、变量命名规则、List、Tupple等

1 字符串打印采用单引号、双引号均可,三引号用于打印多行字符串2 format字符串使用: age=3 name="Tom" print("{0} was {1} years old".format(name,age)) 可使用"+"产生同样的输出效果 print(name+" was "+str(age)+" years old")3 变量命名规则:

2017-03-04 14:49:03 438

原创 LeetCode算法题——Two Sum

原题:Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use th

2017-03-03 20:19:11 418

数学建模教程-涵盖多种建模方法

覆盖了神经网络,灰色预测,时间序列,模式识别等多种建模方法

2014-12-29

C语言砝码组合问题源码

C语言解决砝码组合问题,采用递归的方法解决,寻找递推关系便可以解决这个问题了

2014-11-06

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除