Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaµÝ¹é¡¢·ÇµÝ¹éʵÏÖ¶þ²æÊ÷±éÀú

×î½üÕÒ¹¤×÷×ö±ÊÊÔÌâ·¢ÏÖºÜÖØÒª£¬¾Í×Ô¼ºÐ´ÁËÒ»µã£¬ºÍ´ó¼Ò·ÖÏí
import java.util.Stack;
import java.util.HashMap;
public class BinTree {
private char date;
private BinTree lchild;
private BinTree rchild;
public BinTree(char c) {
date = c;
}
// ÏÈÐò±éÀúµÝ¹é
public static void preOrder(BinTree t) {
if (t == null) {
return;
}
System.out.print(t.date);
preOrder(t.lchild);
preOrder(t.rchild);
}
// ÖÐÐò±éÀúµÝ¹é
public static void InOrder(BinTree t) {
if (t == null) {
return;
}
InOrder(t.lchild);
System.out.print(t.date);
InOrder(t.rchild);
}
// ºóÐò±éÀúµÝ¹é
public static void PostOrder(BinTree t) {
if (t == null) {
return;
}
PostOrder(t.lchild);
PostOrder(t.rchild);
System.out.print(t.date);
}
// ÏÈÐò±éÀú·ÇµÝ¹é
public static void preOrder2(BinTree t) {
Stack<BinTree> s = new Stack<BinTree>();
while (t != null || !s.empty()) {
while (t != null) {
System.out.print(t.date);
s.push(t);
t = t.lchild;
}
if (!s.empty()) {
t = s.pop();
t = t.rchild;
}
}
}
// ÖÐÐò±éÀú·ÇµÝ¹é
public static void InOrder2(BinTree t) {
Stack<BinTree> s = new Stack<BinTree>();
while (t != null || !s.empty()) {
while (t != null) {
s.push(t);
t = t.lchild;
}
if (!s.empty()) {
t = s.pop();
System.out.print(t.date);
t = t.rchild;
}
}
}
// ºóÐò±éÀú·ÇµÝ¹é
public static void PostOrder2(BinTree t) {
Stack<BinTree> s = new Stack<BinTree>();
Stack<Integer> s2 = new Stack<Integer>();
Integer i = new Integer(1);
while (t != null || !s.empty()) {
while (t != null) {
s.push(t);
s2.push(new Integer(0));
t = t.lchild;
}
while (!s.empty() && s2.peek().equals(i)) {
s2.pop();
System.out.print(s.pop().date);
}
if (!s.empty()) {
s2.pop();
s2.push(new Integer(1));
t = s.peek();
t = t.rchild;
}


Ïà¹ØÎĵµ£º

JavaÐÂÊÖÈëÃźÜÖØÒªµÄ¼¸¸ö»ù±¾¸ÅÄî

 finalÀࣺΪ·ÀÖ¹ËûÈË´ÓÄãµÄÀàÉÏÅÉÉúÐÂÀ࣬´ËÀàÊDz»¿ÉÀ©Õ¹µÄ¡£
¡¡¡¡¶¯Ì¬µ÷ÓñȾ²Ì¬µ÷Óû¨·ÑµÄʱ¼äÒª³¤¡£
¡¡¡¡³éÏóÀࣺ¹æ¶¨Ò»¸ö»ò¶à¸ö³éÏó·½·¨µÄÀà±¾Éí±ØÐ붨ÒåΪabstract¡£
¡¡¡¡Àý£º public abstract string getDescripition
¡¡¡¡JavaÖеÄÿһ¸öÀ඼ÊÇ´ÓObjectÀàÀ©Õ¹¶øÀ´µÄ¡£
¡¡¡¡objectÀàÖеÄequalºÍtoString·½· ......

JAVA£¨¸ß¼¶£©¹¤³Ìʦ

Ò»¡¢JAVA¡£ÒªÏë³ÉΪJAVA£¨¸ß¼¶£©¹¤³Ìʦ¿Ï¶¨ÒªÑ§Ï°JAVA¡£Ò»°ãµÄ³ÌÐòÔ±»òÐíÖ»ÐèÖªµÀһЩJAVAµÄÓï·¨½á¹¹¾Í¿ÉÒÔÓ¦¸¶ÁË¡£µ«Òª³ÉΪJAVA£¨¸ß¼¶£©¹¤³Ìʦ£¬ÄúÒª¶ÔJAVA×ö±È½ÏÉîÈëµÄÑо¿¡£ÄúÓ¦¸Ã¶àÑо¿Ò»ÏÂJDBC¡¢IO°ü¡¢Util°ü¡¢Text°ü¡¢JMS¡¢EJB¡¢RMI¡¢Ï̡߳£Èç¹û¿ÉÄÜ£¬Ï£ÍûÄú¶ÔJAVAµÄËùÓаü¶¼ä¯ÀÀһϣ¬ÖªµÀ´ó¸ÅµÄAPI£¬ÕâÑùÄú¾Í·¢ÏÖÆä ......

JAVA Ìåϵ¼°Æä±à³ÌµÄ¹ý³Ì

 JAVA Ìåϵ¼°Æä±à³ÌµÄ¹ý³Ì
  °¥£¬±ÏÒµÁËÒ²Ò»¶Îʱ¼äÁË£¬Ö»ÖªµÀÌìÌì³­´úÂ룬 JAVA µÄ»ù´¡ÖªÊ¶»ù±¾ÊÇÍüµôÁË£¬¼ÓÉÏÒÔǰһֱûÓÐϵͳµØѧϰ¹ý£¬¸Ð¾õ¿ìÒª·ÏÁË¡£»¹ÊǺúþ²ÏÂÐÄÀ´Ñ§Ñ§»ù´¡°É¡£²»ÄÜÌìÌ쿼³­´úÂë¹ýÈÕ×Ó°¡¡£¡£¡£¡££¨ÏÂÎÄ´ó¶àÀ´×Կα¾ÒÔ¼°Ò»Ð©¼¼ÊõÊÓƵÉϵÄÄÚÈÝ£¬»ù±¾Àí½âÁËһЩÁË£¬Ê£ÏµÄÓÉÒÔºóµÄѧϰÂýÂýÔ ......

Java¼¯ºÏÀàList/Set/MapµÄÇø±ðºÍÁªÏµ

 
Ò»¡¢Array £¬ Arrays
JavaËùÓГ´æ´¢¼°Ëæ»ú·ÃÎÊÒ»Á¬´®¶ÔÏó”µÄ×ö·¨£¬arrayÊÇ×îÓÐЧÂʵÄÒ»ÖÖ¡£
1¡¢
ЧÂʸߣ¬µ«ÈÝÁ¿¹Ì¶¨ÇÒÎÞ·¨¶¯Ì¬¸Ä±ä¡£
array»¹ÓÐÒ»¸öȱµãÊÇ£¬ÎÞ·¨ÅжÏÆäÖÐʵ¼Ê´æÓжàÉÙÔªËØ£¬lengthÖ»ÊǸæËßÎÒÃÇarrayµÄÈÝÁ¿¡£
2¡¢JavaÖÐÓÐÒ»¸öArraysÀ࣬רÃÅÓÃÀ´²Ù×÷array¡£
   
a ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ