锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
蹇熸帓搴忕殑綆楁硶鎬濇兂錛?br />
蹇熸帓搴忛噰鐢ㄤ簡鍒嗘不鐨勭瓥鐣ワ紝灝嗗師闂鍒嗚В涓鴻嫢騫蹭釜瑙勬ā鏇村皬浣嗙粨鏋勪笌鍘熼棶棰樼浉浼肩殑瀛愰棶棰樸傜敤閫掑綊鏂規(guī)硶瑙e喅瀛愰棶棰橈紝鐒跺悗灝嗚繖浜涘瓙闂鐨勮В緇勫悎涓哄師闂鐨勮В銆?br />
蹇熸帓搴忕殑紼嬪簭鐨勪竴鑸繃紼嬪彲綆鍗曟弿榪頒負(fù)錛?br />
1.鐢ㄧ粺涓鐨勬柟娉曞彇寰?pivot(杞?銆?br />
2.鏍規(guī)嵁pivot 瀵瑰凡鏈夋暟緇勮繘琛屾帓搴?br />
1) 灝哸rray[pivot]瀛樺偍鍦╰mp鍙橀噺涓紝浣滀負(fù)姣旇緝鍩哄噯銆?br />
浠ow銆乭igh鍒嗗埆浠庡墠鍚戝悗銆佷粠鍚庡悜鍓嶉亶鍘嗘暟緇?br />
2) 浠庡悗鍚戝墠閬嶅巻錛屾壘鍒扮涓涓皬浜巘mp鐨勬暟錛屽皢鍏剁Щ鍔ㄥ埌l(fā)ow鐨勪綅緗?br />
3) 浠庡墠鍚戝悗閬嶅巻錛屾壘鍒扮涓涓ぇ浜巘mp鐨勬暟錛屽皢鍏剁Щ鍔ㄥ埌high鐨勪綅緗?br />
4) 寰幆2銆?姝ワ紝鐩村埌涓ゆ寚閽堥噸鍙?鍗抽鍑哄驚鐜殑鏉′歡鏄?low >= high)錛屽皢tmp縐誨姩鍒發(fā)ow(姝ゆ椂low涓巋igh閲嶅悎)鐨勪綅緗紝騫跺皢low榪斿洖鎴愪負(fù)鏂扮殑pivot銆?br />
5) 鏍規(guī)嵁4姝ヨ繑鍥炵殑pivot錛屽宸叉湁鏁扮粍榪涜鍒掑垎錛?锝瀙ivot-1 鍜?pivot+1 锝?array.lenght錛岄掑綊1锝?姝ャ傜洿鍒拌皟鐢ㄩ鍑恒?br />
鐩鎬俊瀵逛簬浠ヤ笂鐞嗚澶у涓瀹氭槸鑰崇啛鑳借浜嗭紝浣嗙悊瑙h搗鏉ヨ繕鏄瘮杈冩娊璞★紝涓嬮潰鎴戝氨鐢‥xcel鐢誨浘綆鍗曠殑鎻忚堪涓涓?蹇熸帓搴?鐨勮繃紼嬨?br />
鍋囪鎴戜滑瑕佸啓涓涓▼搴忓宸叉湁鏁扮粍榪涜鎺掑簭錛岀畝鍗曡搗瑙侊紝璁懼畾寰呮帓搴忔暟緇勪負(fù) int[] array = { 4, 2, 1, 7, 5, 3, 8, 6 }銆傚鍏剁敤蹇熸帓搴忕畻娉曡繘琛屾帓搴忥紝榪囩▼鎻忚堪濡備笅錛?br />
1.鏍規(guī)嵁宸叉湁寰呮帓搴忔暟緇勶紝鍙栧緱pivot錛屾垜鍦ㄨ繖閲屽彇寰梡ivot鐨勭瓥鐣ュ氨鏄?鍙?鏁扮粍鐨勭涓涓暟錛岃繖閲屽嵆涓?4銆?br />
tmp = 4錛?br />
寰呮帓搴忔暟緇勶細(xì)榛勮壊搴曡壊琛ㄧずpivot銆?br />
2.浠庡悗鍚戝墠縐誨姩high錛屾壘鍒扮涓涓皬浜巘mp鐨勬暟錛屽垯灝嗚鏁扮Щ鍔ㄥ埌l(fā)ow鐨勪綅緗?br />
3.浠庡墠鍚戝悗縐誨姩low錛屾壘鍒扮涓涓ぇ浜巘mp錛?錛夌殑鏁幫紝灝嗗叾縐誨姩鍒癶igh鐨勪綅緗?br />
4.鐒跺悗鍐嶅悜鍓嶇Щ鍔╤igh錛岃瘯鍥炬壘鍒扮涓涓皬浜巘mp(4)鐨勬暟錛屼絾娌℃湁鎵懼埌錛屾鏃秎ow涓巋igh閲嶅彔錛屽皢tmp鐨勫兼斁鍏ow鐨勪綅緗紝騫跺皢low浣滀負(fù)pivot榪斿洖銆?br />
鏍規(guī)嵁鏂扮殑pivot榪涜閫掑綊璋冪敤錛屽皢鍘熷緟鎺掑簭鏁扮粍 鍒嗚В涓轟袱鍧楋紝index鍖洪棿鍒嗗埆涓?锝?錛?锝?錛屽嵆浠ヤ笅涓や釜瀛愭暟緇?br />
(騫舵湭鏂板緩鏁扮粍錛屽彧鏄彧鍏蟲敞榪欎釜鍖洪棿鐨勬暟鎹紝瀵瑰叾榪涜鎺掑簭錛屼篃灝辨槸灝嗛棶棰樺垎瑙d負(fù)涓や釜灝忕殑瀛愰棶棰橈紝浣嗛棶棰樺緢綾諱技銆?
榪欎袱涓暟緇勭殑鎺掑簭榪囩▼榪欓噷灝變笉鐢諱簡錛屼竴鏍風(fēng)殑榪囩▼銆?br />
涓嬮潰鏉ョ湅鐪嬪疄鐜扮殑浠g爜錛屼笌鍒氬垰鐨勮繃紼嬫弿榪版槸絎﹀悎鐨勶細(xì)
嫻嬭瘯浠g爜濡備笅錛?br />
鍦ㄧ綉涓婃煡浜嗕竴浜涘叧浜庢寮傚父鐨勮В鍐蟲柟妗堬紝鍩烘湰涓婇兘鏄瑕佹墿澶inux緋葷粺鐨勬枃浠跺彞鏌勬暟闄愬埗銆?br />
浣嗗鏋滅▼搴忓浜嶴ocket銆丼tream絳変嬌鐢ㄥ悗娌¤兘鍙?qiáng)鏃跺叧闂殑璇濆Q屾墿澶ц繖涓枃浠跺彞鏌勬暟闄愬埗鏄不鏍囦笉娌繪湰鐨勩?br />
鎴戝厛鏄湪嫻嬭瘯鐜鎵╁ぇ浜唋inux鐨勬枃浠跺彞鏌勬暟闄愬埗錛岄殢鍚庢彁楂樻祴璇曞帇鍔涳紝榪囦竴孌墊椂闂村悗鍙戠幇榪樻槸浼?xì)鎶q欎釜寮傚父銆?br />
錛堜腑闂翠篃鐢╨sof鍛戒護(hù)鏌ョ湅鍗犵敤鐨勬枃浠跺彞鏌勬暟錛屼笉鏂殑澧炲姞鍟婏紝蹇冨瘨鍟娿傦級(jí)
鐜拌薄鏄?鐢?lsof -p *** 鏉ユ煡鐪嬶紝褰㈠
java 22055 webapp 21w FIFO 0,6 29300342 pipe
java 22055 webapp 22r FIFO 0,6 29256305 pipe
鍦ㄤ笉鏂鍔犮?br />
鎵浠ユ垜鏋滄柇瀵逛唬鐮佽繘琛屼簡鎺掓煡銆傛枃浠剁殑IO鎿嶄綔銆佸鏁版嵁搴撶殑鎿嶄綔錛岀湅浜嗛兘娌℃湁浠涔堥棶棰橈紝
鏈鍚庢帓鏌ュ埌鐢盝ava紼嬪簭鍘昏皟鐢⊿hell鑴氭湰鐨勪唬鐮侊紝
浠g爜鍐欑殑榪樻槸寰堢畝鍗曠殑錛岀湅涓婂幓寰堟竻鏅幫紝浣嗘槸鏈夋槑鏄劇殑闂錛?/p>
榪欓噷鐨勯棶棰樻槸 瀵規(guī)祦娌℃湁鍦╢inally澶勫仛鍏抽棴澶勭悊銆傝繖涓棶棰樻瘮杈冩槑鏄俱?br />
榪樻湁涓涓棶棰樺氨鏄疨rocess鐨勪嬌鐢ㄩ棶棰橈紝
濡傛灉瀵筆rocess鐨勪笉鐔熸?zhèn)夌殑璇濆Q屽彲鑳戒細(xì)浠ヤ負(fù)return proc.exitValue();涔嬪悗灝變竾浜嬪ぇ鍚変簡銆?br />
錛坋xitValue()紜疄寰堝儚鏄凡緇忛鍑轟簡騫跺緱鍒拌繑鍥炲肩殑鎰忔濓紝浼拌鏄繖涓柟娉曠殑鍚嶅瓧榪鋒儜浜嗘垜浠殑寮鍙戜漢鍛樸傦級(jí)
瀹為檯涓嶇劧錛岀湅Jdk鐨勫府鍔╂枃妗e彲浠ュ彂鐜幫紝瑕侀氳繃destroy()鏉ュ疄鐜板瀛愯繘紼嬬殑閿姣佸茍閲婃斁鍗犵敤鐨凢ile Descriptor銆?/p>
榪欎釜闂錛岀煭鏃墮棿鐨勬祴璇曟槸涓嶄細(xì)鏈夐棶棰樼殑錛屼絾鍦ㄦ姇鍏ョ敓浜у悗錛岄殢鐫紼嬪簭鐨勯暱鏈熻繍琛岋紝寮鍙戜腑鐨勭枏蹇藉氨浼?xì)鏆撮湶浜嗐?br />
鎵浠ュ湪瀵逛嬌鐢ㄧ殑鏂規(guī)硶鎷夸笉鍑嗙殑鎯呭喌涓嬶紝榪樻槸瑕佸鍋氳皟鏌ワ紝璋ㄦ厧浣跨敤鍟娿?br />
甯屾湜鑳借鍦ㄦ帓鏌ョ被浼奸棶棰樼殑鏈嬪弸娉ㄦ剰錛屽鏋滀綘鎺掓煡鐨勪唬鐮佷腑涔熷瓨鍦≧untime.getRuntime().exec(cmd)榪欐牱鐨勮皟鐢紝閭d箞璇風(fēng)‘淇濋偅孌典唬鐮佹病鏈夐棶棰樸?br />
鏈枃涓哄師鍒涳紝嬈㈣繋杞澆錛岃漿杞借娉ㄦ槑鍑哄BlogJava銆?/span>
鎯抽噸鐜拌繖涓満鏅緢瀹規(guī)槗錛岃鐪嬩唬鐮併?/p>
鎵ц姝や唬鐮佺粨鏋滐細(xì)
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
闂灝卞嚭鍦℉uge綾葷殑 getSubString 鏂規(guī)硶錛屽畠璋冪敤浜哠tring綾葷殑substring鏂規(guī)硶銆?/span>
鏉ヨ鎴戜滑鐪嬬湅 substring 綾葷殑瀹炵幇鍚э紝JDK婧愮爜濡備笅錛?/span>
鍐嶈鎴戜滑鎺ヤ笅鏉ョ湅鐪?new String(offset + beginIndex, endIndex - beginIndex, value); 鐨勫疄鐜幫細(xì)
char[] value 鏁扮粍琚叡浜簡銆?/span>
鍦ㄦ垜浠殑main鍑芥暟閲岀殑寰幆涓紝姣忓驚鐜竴嬈″悗錛屾垜浠笇鏈汬uge瀵硅薄琚洖鏀訛紝涓旈噴鏀懼畠鍗犳湁鐨勫唴瀛樸?/span>
浣嗗疄闄呬笂 private String str = new String(new char[100000]); 鍗犳湁鐨勫唴瀛樺茍涓嶄細(xì)琚噴鏀俱?/span>
鍥犱負(fù) 鎴戜滑閫氳繃 Huge 綾葷殑 getSubString 鏂規(guī)硶寰楀埌鐨?String 瀵硅薄榪樺瓨鍦?瀛樺湪浜?/span>handler鐨勫垪琛ㄤ腑)錛?/span>
瀹冭櫧鐒舵槸 length 鍙湁 4 鐨勫璞★紝鍗翠韓鏈夌潃 char[100000] 鐨勭┖闂淬?/span>
瑙e喅鏂規(guī)錛?/span>
鍙互淇敼Huge 綾葷殑 getSubString 鏂規(guī)硶濡備笅錛?/span>
鍙鍐嶅涓涓猄tring鐨勬瀯閫犳柟娉曞嵆鍙?/span>
鑷充簬涓轟粈涔堬紝鐪嬬湅JDK婧愮爜錛屼竴鐪嬩究鐭ヤ簡銆傝繖閲屽氨涓嶈創(chuàng)鍑烘潵浜嗐?/span>
鍞夛紝浠ュ悗鍐欎唬鐮佸緱澶氬灝忓績鍟娿?/span>
http://topic.csdn.net/u/20090113/17/5abc9a50-64dd-4277-af73-e8d2b762a469.html
鎴戣創(chuàng)榪囨潵錛岃嚜宸卞仛涓涓嬨?/p>
棰樼洰1錛?One team tries to buy several bottle of drinks for 27 athletes. In ABC store three empty bottles can be exchanged
with one new bottle of drinks. Which of the following numbers is the minimal one that the team should buy for the 27
athletes?
絳旓細(xì)鑷繁瀹炵幇浜嗕竴涓紝姣旇緝綆鍗曠殑銆?br />棰樼洰2錛?How can you create a listener class that receives events when the mouse is moved(single Answer)
A By extending MouseListener
B By implementing MouseListener
C By extending Mouse Motion Listener
D By implementing Mouse Motion Listener
E Either by extending Mouse Motion Listener or extending MouseListener
F Either by implementing Mouse Motion Listener or implementing MouseListener
棰樼洰3錛?You are assign the task of building a panel containing a TextArea at the top, a label directly below it, and a button
directly below the label. If the three components are added directly to the panel, which layout manager can be panel use to
ensure that the TextArea absorbs all of the free vertical space when the parel is resized?
棰樼洰4錛?Which are not containers in Java?(Multiple answer)
A ScollPane
B Canvas
C Scrollbar
D Applet
E Dialog
棰樼洰5錛歒ou need to store elements in a collection that
guarantees that no duplicates are stored and all elements
can be access in nature order, which interface provides
that capability?
A java.uil.Map
B java.util.Collection
C java.util.List
D java.util.SortedSet
E java.util.SortedMap
F java.util.Set
棰樼洰6錛歐hat will happen when you attempt to compile and run this
code?
abstract class Base{
abstract public void myfunc();
public class Abs extends Base{
public static void main(String argv[])
{
Abs a = new Abs();
a.amethod();
}
public void amethod(){
System.out.println("A method");;
}
}
A The code will compile and run, printing out the words "A
method"
B The compiler will complain errors in Base class.
C The code will compile but complain at run time that the
Base class has none abstract methods.
D The compiler will complain errors in Abs class
棰樼洰7錛?Description
import java.util.*;
public class Test
{
private String value = null;
public Test(String v)
{
value = v;
}
public boolean equals(Test o)
{
if(o==this) return true;
if(o instanceof Test)
{
Test test =(Test) o;
return value.equals(test.value);
}
return false;
}
public static void main(String[] args)
{
List list = new ArrayList();
Test test1 = new Test("object");
Test test2 = new Test("object");
Test test3 = new Test("object");
Object test4 = new Test("object");
list.add(test1);
System.out.println(list.contains(test2));
System.out.println(test2.equals(test3));
System.out.println(test3.equals(test4));
}
}
棰樼洰8錛?
Which of the following is NOT true regarding to RuntimeException?
A RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtul
Machine.
B A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the
execution of the method but not caught.
C An RuntimeException is a subclass of Throwable that indicates serious problems that a reasonable application should not try
to catch.
D NullPointerException is one kind of RuntimeException.
棰樼洰9錛?Which of the following items demonstrates the key characteristics of Web 2.0
A Centralized
B User centered design
C Open
D Light Weight
棰樼洰10錛?When using the writeObject method to store the state of n object, how can you protect sensitive data from being
accessed in the stored object?
A Implement the Object as Exteralizable
B Declare the sensitive fields as private transient
C Declare the sensitive fields as static transient
D Declare the sensitive fields as protected transient
鐢↗ava璁捐涓涓▼搴?瀹炵幇涓涓瓧絎︿覆鐨勫縐頒釜鏁?濡傚瓧絎︿覆"effeghg",鏈?ff","effe","ghg"榪欎笁涓縐板瓧絎?鎵浠ヨ繑鍥?.
鎴戝疄鐜扮殑鎬濊礬灝辨槸閬嶅巻榪欎釜瀛楃涓詫紝
鍏堥夊畾澶翠綅緗負(fù)絎竴涓瓧絎︼紝鐒跺悗浠庢渶鍚庡悜鍓嶉亶鍘嗚繖涓瓧絎︿覆錛?/p>
澶村熬涓や釜瀛楃鐩稿悓錛屽垯鍙栦腑闂村瓧絎︿覆錛岃繘琛岄掑綊銆?/p>
閫掑綊緇撴潫鍚庡緱鍒扮粨鏋滐紝
緇х畫灝嗗ご鍚戝悗鎺?浣嶏紝鐒跺悗鍐嶄粠瀛楃涓叉渶鍚庡悜鍓嶉亶鍘嗭紝
濡傛寰幆錛屽綋灝劇瓑浜庡ご鏃訛紝閫鍑烘渶澶栧眰寰幆錛岃緭鍑虹粨鏋溿?/p>
鍏蜂綋瀹炵幇錛?/p>