白话经典算法系列之二直接插入排序的三种实现#includevoidInsert_sort(inta[],intn){for(inti=1;i=0;j--){if(a[j]
快速排序
mal327
数据结构面试算法腾讯微软
白话经典算法系列之六快速排序快速搞定本文来自:http://blog.csdn.net/morewindows/article/details/6684558快速排序由于排序效率在同为O(N*logN)的几种排序方法中效率较高,因此经常被采用,再加上快速排序思想----分治法也确实实用,因此很多软件公司的笔试面试,包括像腾讯,微软等知名IT公司都喜欢考这个,还有大大小的程序方面的考试如软考,考研中
【白话经典算法系列之十四】腾讯2012年实习生笔试加分题
iteye_2116
地址:http://blog.csdn.net/morewindows/article/details/8742666转载请标明出处,谢谢。欢迎关注微博:http://weibo.com/MoreWindows之前参加2012年腾讯实习生笔试时,在考场中遇到一道加分题,当时灵光一闪,直接挥笔就解决这道题目。今天看到学校论坛上有师弟师妹们在询问这题的解法,就写篇博客来分享我的解法吧,也欢迎大家讨论其
快速排序
huangmi2958
C/C++
这个博主写的通俗易懂:白话经典算法系列之六快速排序快速搞定贴上我自己的代码:voidq_sort(int*nums,intl,intr){if(l=x&&i<j){j--;}nums[i]=nums[j];while(nums[i]<=x&&i<j){i++;}nums[j]=nums[i];}nums[i]=x;q_sort(nums,l,i-1);q_sort(nums,i+1,r);}}
小顶堆的插入删除操作
jinzi锦梓
VC
堆的插入每次插入都是将新数据放在数组最后。可以发现从这个新数据的父结点到根结点必然为一个有序的数列,现在的任务是将这个新数据插入到这个有序数据中——这就类似于直接插入排序中将一个数据并入到有序区间中,对照《白话经典算法系列之二直接插入排序的三种实现》不难写出插入一个新数据时堆的调整代码:[cpp]viewplaincopy//新加入i结点其父结点为(i-1)/2voidMinHeapFixup(i
白话经典算法:冒泡,直接插入,希尔,快速排序
Self_Chou
编程相关
原帖开始链接:http://blog.csdn.net/morewindows/article/details/6657829http://www.cnblogs.com/morewindows/archive/2011/08/13/2137415.html冒泡排序是非常容易理解和实现,,以从小到大排序举例:设数组长度为N。1.比较相邻的前后二个数据,如果前面数据大于后面的数据,就将二个数据交换。
白话经典算法系列之五 归并排序的实现(讲的真好)
yuehailin
归并排序是建立在归并操作上的一种有效的排序算法。该算法是采用分治法(DivideandConquer)的一个非常典型的应用。首先考虑下如何将将二个有序数列合并。这个非常简单,只要从比较二个数列的第一个数,谁小就先取谁,取了后就在对应数列中删除这个数。然后再进行比较,如果有数列为空,那直接将另一个数列的数据依次取出即可。[cpp]viewplaincopy//将有序数组a[]和b[]合并到c[]中v
白话经典算法系列之八 MoreWindows白话经典算法之七大排序总结篇
MoreWindows
白话经典算法系列Windows编程WindowsC/C++/C#编程白话经典算法
在我的博客对冒泡排序,直接插入排序,直接选择排序,希尔排序,归并排序,快速排序和堆排序这七种常用的排序方法进行了详细的讲解,并做成了电子书以供大家下载。下载地址为:http://download.csdn.net/detail/morewindows/4443208。有网友提议到这本《MoreWindows白话经典算法之七大排序》电子书讲解细致用来平时学习是非常好的,但是页数有22页,不太合适做面
C++实现基本排序算法2:冒泡排序和快速排序
alxe_made
C++
交换排序的基本思想是:两两比较待排列的元素,返现倒序即交换。基于这种思想的有两种排序方法,即冒泡排序和快速排序。1.冒泡排序和快速排序的基本原理参考文章:c++实现冒泡排序冒泡排序(C/C++实现)算法3:最常用的排序——快速排序白话经典算法系列之六快速排序快速搞定2.参考代码#include#includevoidSwap(std::vector&unorder_array,inta,intb)
MoreWindows博客目录(微软最有价值专家,原创技术文章152篇)
MoreWindows
为了方便大家查找和学习,现将本人博客中所有博客文章列出目录。一.白话经典算法目前有17篇,分为七大排序和经典面试题讲解两大类1.《白话经典算法系列之一冒泡排序的三种实现》2.《白话经典算法系列之二直接插入排序的三种实现》3.《白话经典算法系列之三希尔排序的实现》4.《白话经典算法系列之四直接选择排序及交换二个数据的正确实现》5.《白话经典算法系列之五归并排序的实现》6.《白话经典算法系列之六快速排
[C/C++基础知识] 一篇就让你彻底搞懂qsort快速排序的文章
Eastmount
C/C++基础知识数据结构面试工作C语言快速排序sort结构快排分治法
最近在做LeetCode的题目、面试和笔试后发现经常考察快速排序的知识。通过这篇文章介绍,能让你彻底的了解和学习快排,主要从一下三个部分进行介绍:一.C语言实现qsort快速排序二.快速排序的原理及手写快排源码三.LeetCode关于TwoSum的快排实现参考文献:《算法分析与设计》关于分治法那章内容如何利用C语言中的qsort库函数实现快速排序-by:stpeace白话经典算法系列之六快速排序快
白话经典算法系列之一 冒泡排序的三种实现(转)
zhangyunhong98
笔试题
#includeusingnamespacestd;//交换两个数,这里用到了引用voidSwap(int&a,int&b){inttemp;temp=a;a=b;b=temp;return;}voidBubbleSort1(inta[],intlen){inti,j;for(i=0;ia[j]){Swap(a[j-1],a[j]);}}}return;}/*优化这个版本*设置一个标志flag,如
白话经典算法系列之二 直接插入排序的三种实现(转)
zhangyunhong98
笔试题
http://blog.csdn.net/morewindows/article/details/6665714#includeusingnamespacestd;//交换两个数,这里用到了引用voidSwap(int&a,int&b){inttemp;temp=a;a=b;b=temp;return;}voidInsertion_Sort2(inta[],intlen){inti,j;intte
最小堆最大堆的详细解读
qwezhaohaihong
数据结构
2013-09-1316:3616408人阅读评论(1)收藏举报本文章已收录于:版权声明:本文为博主原创文章,未经博主允许不得转载。转自:码农下的天桥目录(?)[+]堆排序解释第一篇描述不太清楚最大堆的插入删除调整排序操作图解程序JAVA此坑待埋。点击打开漫谈经典排序算法:一、从简单选择排序到堆排序的深度解析链接白话经典算法系列之七堆与堆排序二叉排序树与二叉堆堆排序(注:这篇文章说明了如何从一个数
堆排序算法的实现
khq溪风
数据结构基础
参考博客:白话经典算法系列之七堆与堆排序参考视频:堆排序(heapsort)/*************************************功能:对数组元素进行堆排序*作者:khq*时间:2020年4月23日*************************************/#includevoidheapify(inttree[],intn,inti);voidswap(in
插入排序和希尔排序的实现
khq溪风
数据结构基础
参考博客:MoreWindows博客——白话经典算法插入排序#includevoidswap(inta[],inti,intj);voidinsertSort(inta[],intn);voidprintArr(inta[],intn);intmain(void){inta[8]={-2,5,-9,3,16,12,7,35};printf("排序前的数组:\n");printArr(a,8);in
归并排序算法的实现
khq溪风
数据结构基础排序算法数据结构归并排序
参考博客:白话经典算法系列之五归并排序的实现参考视频:归并排序/************************功能:归并排序*作者:khq*时间:2020.4.22************************/#include//方法声明voidmerge(inta[],int,int,int);voidmergeSort(inta[],int,int);voidprintArr(inta[
白话经典算法系列之十 一道有趣的GOOGLE面试题
MoreWindows
白话经典算法系列WindowsC/C++/C#编程白话经典算法
微博http://weibo.com/MoreWindows已开通,欢迎关注。最近在微博上看到一道有趣的GOOGLE面试题,见下图:文字版:一个大小为n的数组,里面的数都属于范围[0,n-1],有不确定的重复元素,找到至少一个重复元素,要求O(1)空间和O(n)时间。这个题目要求用O(n)的时间复杂度,这意味着只能遍历数组一次。同时还要寻找重复元素,很容易想到建立哈希表来完成,遍历数组时将每个元素
白话经典算法系列之五 归并排序的实现
MoreWindows
白话经典算法系列WindowsC/C++/C#编程白话经典算法
归并排序是建立在归并操作上的一种有效的排序算法。该算法是采用分治法(DivideandConquer)的一个非常典型的应用。首先考虑下如何将将二个有序数列合并。这个非常简单,只要从比较二个数列的第一个数,谁小就先取谁,取了后就在对应数列中删除这个数。然后再进行比较,如果有数列为空,那直接将另一个数列的数据依次取出即可。//将有序数组a[]和b[]合并到c[]中voidMemeryArray(int
Enum 枚举
120153216
enum枚举
原文地址:http://www.cnblogs.com/Kavlez/p/4268601.html Enumeration
于Java 1.5增加的enum type...enum type是由一组固定的常量组成的类型,比如四个季节、扑克花色。在出现enum type之前,通常用一组int常量表示枚举类型。比如这样:
public static final int APPLE_FUJI = 0
Java8简明教程
bijian1013
javajdk1.8
Java 8已于2014年3月18日正式发布了,新版本带来了诸多改进,包括Lambda表达式、Streams、日期时间API等等。本文就带你领略Java 8的全新特性。
一.允许在接口中有默认方法实现
Java 8 允许我们使用default关键字,为接口声明添
Oracle表维护 快速备份删除数据
cuisuqiang
oracle索引快速备份删除
我知道oracle表分区,不过那是数据库设计阶段的事情,目前是远水解不了近渴。
当前的数据库表,要求保留一个月数据,且表存在大量录入更新,不存在程序删除。
为了解决频繁查询和更新的瓶颈,我在oracle内根据需要创建了索引。但是随着数据量的增加,一个半月数据就要超千万,此时就算有索引,对高并发的查询和更新来说,让然有所拖累。
为了解决这个问题,我一般一个月会进行一次数据库维护,主要工作就是备
java多态内存分析
麦田的设计者
java内存分析多态原理接口和抽象类
“ 时针如果可以回头,熟悉那张脸,重温嬉戏这乐园,墙壁的松脱涂鸦已经褪色才明白存在的价值归于记忆。街角小店尚存在吗?这大时代会不会牵挂,过去现在花开怎么会等待。
但有种意外不管痛不痛都有伤害,光阴远远离开,那笑声徘徊与脑海。但这一秒可笑不再可爱,当天心
Xshell实现Windows上传文件到Linux主机
被触发
windows
经常有这样的需求,我们在Windows下载的软件包,如何上传到远程Linux主机上?还有如何从Linux主机下载软件包到Windows下;之前我的做法现在看来好笨好繁琐,不过也达到了目的,笨人有本方法嘛;
我是怎么操作的:
1、打开一台本地Linux虚拟机,使用mount 挂载Windows的共享文件夹到Linux上,然后拷贝数据到Linux虚拟机里面;(经常第一步都不顺利,无法挂载Windo
类的加载ClassLoader
肆无忌惮_
ClassLoader
类加载器ClassLoader是用来将java的类加载到虚拟机中,类加载器负责读取class字节文件到内存中,并将它转为Class的对象(类对象),通过此实例的 newInstance()方法就可以创建出该类的一个对象。
其中重要的方法为findClass(String name)。
如何写一个自己的类加载器呢?
首先写一个便于测试的类Student
html5写的玫瑰花
知了ing
html5
<html>
<head>
<title>I Love You!</title>
<meta charset="utf-8" />
</head>
<body>
<canvas id="c"></canvas>
google的ConcurrentLinkedHashmap源代码解析
矮蛋蛋
LRU
原文地址:
http://janeky.iteye.com/blog/1534352
简述
ConcurrentLinkedHashMap 是google团队提供的一个容器。它有什么用呢?其实它本身是对
ConcurrentHashMap的封装,可以用来实现一个基于LRU策略的缓存。详细介绍可以参见
http://code.google.com/p/concurrentlinke
webservice获取访问服务的ip地址
alleni123
webservice
1. 首先注入javax.xml.ws.WebServiceContext,
@Resource
private WebServiceContext context;
2. 在方法中获取交换请求的对象。
javax.xml.ws.handler.MessageContext mc=context.getMessageContext();
com.sun.net.http
菜鸟的java基础提升之道——————>是否值得拥有
百合不是茶
1,c++,java是面向对象编程的语言,将万事万物都看成是对象;java做一件事情关注的是人物,java是c++继承过来的,java没有直接更改地址的权限但是可以通过引用来传值操作地址,java也没有c++中繁琐的操作,java以其优越的可移植型,平台的安全型,高效性赢得了广泛的认同,全世界越来越多的人去学习java,我也是其中的一员
java组成:
通过修改Linux服务自动启动指定应用程序
bijian1013
linux
Linux中修改系统服务的命令是chkconfig (check config),命令的详细解释如下: chkconfig
功能说明:检查,设置系统的各种服务。
语 法:chkconfig [ -- add][ -- del][ -- list][系统服务] 或 chkconfig [ -- level <</SPAN>
spring拦截器的一个简单实例
bijian1013
javaspring拦截器Interceptor
Purview接口
package aop;
public interface Purview {
void checkLogin();
}
Purview接口的实现类PurviesImpl.java
package aop;
public class PurviewImpl implements Purview {
public void check
[Velocity二]自定义Velocity指令
bit1129
velocity
什么是Velocity指令
在Velocity中,#set,#if, #foreach, #elseif, #parse等,以#开头的称之为指令,Velocity内置的这些指令可以用来做赋值,条件判断,循环控制等脚本语言必备的逻辑控制等语句,Velocity的指令是可扩展的,即用户可以根据实际的需要自定义Velocity指令
自定义指令(Directive)的一般步骤
&nbs
【Hive十】Programming Hive学习笔记
bit1129
programming
第二章 Getting Started
1.Hive最大的局限性是什么?一是不支持行级别的增删改(insert, delete, update)二是查询性能非常差(基于Hadoop MapReduce),不适合延迟小的交互式任务三是不支持事务2. Hive MetaStore是干什么的?Hive persists table schemas and other system metadata.
nginx有选择性进行限制
ronin47
nginx 动静 限制
http {
limit_conn_zone $binary_remote_addr zone=addr:10m;
limit_req_zone $binary_remote_addr zone=one:10m rate=5r/s;...
server {...
location ~.*\.(gif|png|css|js|icon)$ {
java-4.-在二元树中找出和为某一值的所有路径 .
bylijinnan
java
/*
* 0.use a TwoWayLinkedList to store the path.when the node can't be path,you should/can delete it.
* 1.curSum==exceptedSum:if the lastNode is TreeNode,printPath();delete the node otherwise
Netty学习笔记
bylijinnan
javanetty
本文是阅读以下两篇文章时:
http://seeallhearall.blogspot.com/2012/05/netty-tutorial-part-1-introduction-to.html
http://seeallhearall.blogspot.com/2012/06/netty-tutorial-part-15-on-channel.html
我的一些笔记
===
js获取项目路径
cngolon
js
//js获取项目根路径,如: http://localhost:8083/uimcardprj
function getRootPath(){
//获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp
var curWwwPath=window.document.locati
oracle 的性能优化
cuishikuan
oracleSQL Server
在网上搜索了一些Oracle性能优化的文章,为了更加深层次的巩固[边写边记],也为了可以随时查看,所以发表这篇文章。
1.ORACLE采用自下而上的顺序解析WHERE子句,根据这个原理,表之间的连接必须写在其他WHERE条件之前,那些可以过滤掉最大数量记录的条件必须写在WHERE子句的末尾。(这点本人曾经做过实例验证过,的确如此哦!
Shell变量和数组使用详解
daizj
linuxshell变量数组
Shell 变量
定义变量时,变量名不加美元符号($,PHP语言中变量需要),如:
your_name="w3cschool.cc"
注意,变量名和等号之间不能有空格,这可能和你熟悉的所有编程语言都不一样。同时,变量名的命名须遵循如下规则:
首个字符必须为字母(a-z,A-Z)。
中间不能有空格,可以使用下划线(_)。
不能使用标点符号。
不能使用ba
编程中的一些概念,KISS、DRY、MVC、OOP、REST
dcj3sjt126com
REST
KISS、DRY、MVC、OOP、REST (1)KISS是指Keep It Simple,Stupid(摘自wikipedia),指设计时要坚持简约原则,避免不必要的复杂化。 (2)DRY是指Don't Repeat Yourself(摘自wikipedia),特指在程序设计以及计算中避免重复代码,因为这样会降低灵活性、简洁性,并且可能导致代码之间的矛盾。 (3)OOP 即Object-Orie
[Android]设置Activity为全屏显示的两种方法
dcj3sjt126com
Activity
1. 方法1:AndroidManifest.xml 里,Activity的 android:theme 指定为" @android:style/Theme.NoTitleBar.Fullscreen" 示例: <application
solrcloud 部署方式比较
eksliang
solrCloud
solrcloud 的部署其实有两种方式可选,那么我们在实践开发中应该怎样选择呢? 第一种:当启动solr服务器时,内嵌的启动一个Zookeeper服务器,然后将这些内嵌的Zookeeper服务器组成一个集群。 第二种:将Zookeeper服务器独立的配置一个集群,然后将solr交给Zookeeper进行管理
谈谈第一种:每启动一个solr服务器就内嵌的启动一个Zoo
Java synchronized关键字详解
gqdy365
synchronized
转载自:http://www.cnblogs.com/mengdd/archive/2013/02/16/2913806.html
多线程的同步机制对资源进行加锁,使得在同一个时间,只有一个线程可以进行操作,同步用以解决多个线程同时访问时可能出现的问题。
同步机制可以使用synchronized关键字实现。
当synchronized关键字修饰一个方法的时候,该方法叫做同步方法。
当s
js实现登录时记住用户名
hw1287789687
记住我记住密码cookie记住用户名记住账号
在页面中如何获取cookie值呢?
如果是JSP的话,可以通过servlet的对象request 获取cookie,可以
参考:http://hw1287789687.iteye.com/blog/2050040
如果要求登录页面是html呢?html页面中如何获取cookie呢?
直接上代码了
页面:loginInput.html
代码:
<!DOCTYPE html PUB
开发者必备的 Chrome 扩展
justjavac
chrome
Firebug:不用多介绍了吧https://chrome.google.com/webstore/detail/bmagokdooijbeehmkpknfglimnifench
ChromeSnifferPlus:Chrome 探测器,可以探测正在使用的开源软件或者 js 类库https://chrome.google.com/webstore/detail/chrome-sniffer-pl
算法机试题
李亚飞
java算法机试题
在面试机试时,遇到一个算法题,当时没能写出来,最后是同学帮忙解决的。
这道题大致意思是:输入一个数,比如4,。这时会输出:
&n
正确配置Linux系统ulimit值
字符串
ulimit
在Linux下面部 署应用的时候,有时候会遇上Socket/File: Can’t open so many files的问题;这个值也会影响服务器的最大并发数,其实Linux是有文件句柄限制的,而且Linux默认不是很高,一般都是1024,生产服务器用 其实很容易就达到这个数量。下面说的是,如何通过正解配置来改正这个系统默认值。因为这个问题是我配置Nginx+php5时遇到了,所以我将这篇归纳进
hibernate调用返回游标的存储过程
Supanccy2013
javaDAOoracleHibernatejdbc
注:原创作品,转载请注明出处。
上篇博文介绍的是hibernate调用返回单值的存储过程,本片博文说的是hibernate调用返回游标的存储过程。
此此扁博文的存储过程的功能相当于是jdbc调用select 的作用。
1,创建oracle中的包,并在该包中创建的游标类型。
---创建oracle的程
Spring 4.2新特性-更简单的Application Event
wiselyman
application
1.1 Application Event
Spring 4.1的写法请参考10点睛Spring4.1-Application Event
请对比10点睛Spring4.1-Application Event
使用一个@EventListener取代了实现ApplicationListener接口,使耦合度降低;
1.2 示例
包依赖
<p