自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(20)
  • 资源 (1)
  • 收藏
  • 关注

原创 [数据结构]字符串匹配——朴素算法

public int index(String a,String b,int pos){ int i=pos; int j=0; while(i<a.length()&&j<b.length()){ if(a.charAt(i)==b.charAt(j)){ ++i; ++j; }else{ i=i-j+1; j=0; } }

2017-09-11 19:42:24 519

原创 Java简单实现进程调度算法 FCFS和SJF

import java.text.DecimalFormat;import java.util.LinkedList;import java.util.List;import java.util.Scanner;public class experiment1 { public static void main(String[] args) { Scanner in= new Sc

2017-05-18 11:14:07 11637 4

原创 [leetcode]219. Contains Duplicate II

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is a

2017-03-30 13:14:24 355

原创 [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?判断单链表是否为回文链表此题用栈来做将非常简单,第一次遍历将节点入栈,第二次遍历判断是否为回文public class Solution {

2017-03-30 12:36:08 234

原创 [leetcode]205. Isomorphic Strings

Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with anot

2017-03-29 23:51:01 230

原创 [数据结构]单链表操作 (java)

单链表是一种简单而且常用的数据结构,这里简单总结了关于单链表常用的几种操作。单链表的节点结构如下:class ListNode { int val; ListNode next; ListNode(int x) { val = x; next = null; }} 1.链表反置如:现有链表1->

2017-03-27 20:12:10 394

原创 [leetcode]367. Valid Perfect Square

Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.Example 1:Input: 16Return

2017-03-25 23:54:58 244

原创 [leetcode]345. Reverse Vowels of a String

Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotcede".Note

2017-03-25 23:46:33 353

原创 [leetcode]198. House Robber

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house

2017-03-25 23:01:23 220

原创 [leetcode]235. Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betw

2017-03-25 21:21:08 277

原创 [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.连接两个有序链表,链接后依然有序。遍历两个链表,依次讲较小节点加入新的链表当中。/** * Defini

2017-03-25 20:43:17 263

原创 [leetcode]107. Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree [3,9,20,null,null,1

2017-03-25 16:08:59 291

原创 [leetcode]53. Maximum Subarray

Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1]

2017-03-24 13:29:17 220

原创 [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-03-23 23:41:13 254

原创 [leetcode]121. Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),

2017-03-23 15:51:09 461

原创 [leetcode]405. Convert a Number to Hexadecimal

Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.Note:All letters in hexadecimal (a-f) must be in lowercase.The hexade

2017-03-23 14:59:25 279

原创 [leetcode]108. Convert Sorted Array to Binary Search Tree

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.每次递归取数组的中间值作为根节点,则左子树的根为(left,mid-1)/2对应的值,右子树根为(mid+1,right)/2/** * Definition for a binary t

2017-03-23 14:07:48 379

原创 [leetcode]415. Add Strings

Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2.Note:The length of both num1 and num2 is Both num1 and num2 contains only digits 0-9.

2017-03-23 12:21:32 462

原创 [leetcode]286. Missing Number

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:Your algorithm sho

2017-03-22 23:00:55 355

原创 [Unity]2D打飞机游戏

今天带来一个在自学Unity3D过程中写的第一个2D打飞机小游戏。代码写得不好,功能也很少,主要是为了记录学习心得,也希望各位能够多给些指导。后续应该会有优化和完善游戏功能。闲话不多说,先来分析下游戏:几乎没有什么功能,没有UI。主要有玩家方向键控制飞机移动,空格键射击,敌人被击中后销毁。1.创建工作层为了使游戏对象在场景中的层次不会错乱,可以创建不同的工作层来管理

2016-10-18 10:58:22 5162

《数据结构》的全部代码实现(C语言)

严蔚敏版《数据结构》的全部算法代码实现C语言

2015-11-01

空空如也

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

TA关注的人

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