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

java£ºÊÖдMyLinkedListËùÓз½·¨£¬Ôöɾ¸Ä²é

package arrays.myArray;
public class MyLinkedList {
 private int size = 0;
 private Node1 head = null;
 // Ìí¼Ó
 public void add(Object obj) {
  add(size, obj);
 }
 // ÐÞ¸Ä
 public void add(int index, Object obj) {
  if (null == head) {
   head = new Node1(obj, null);
  } else {
   if (0 == index) {
    head = new Node1(obj, head);
   } else {
    Node1 temp = head;
    for (int i = 0; i < index - 1; i++) {
     temp = temp.next;
    }
    temp.next = new Node1(obj, temp.next);
   }
  }
  size++;
 }
 // ÒƳý
 public void remove(int index) {
  if (0 == index) {
   head = head.next;
  } else {
   Node1 temp = head;
   for (int i = 0; i < index - 1; i++) {
    temp = temp.next;
   }
   temp.next = temp.next.next;
  }
  size--;
 }
 // ²éѯ
 public Object get(int index) {
  Node1 temp = head;
  for (int i = 0; i < index; i++) {
   temp = temp.next;
  }
  return temp.obj;
 }
 // ×ܳ¤¶È
 public int size() {
  return size;
 }
}
class Node1 {
 Object obj;
 Node1 next;
 public Node1(Object obj, Node1 next) {
  this.obj = obj;
  this.next = next;
 }
}


Ïà¹ØÎĵµ£º

JavaÖм¯ºÏÈÝÆ÷ÀàListºÍSetµÄÓ÷¨

ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1  List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......

Java´®¿Ú±à³Ì1

    ¹«Ë¾Óõ½´®¿Ú±à³Ì£¬¹Ê¿ªÊ¼Ñо¿£¬Ê×ÏÈËѵ½µÄÊÇjavacomm20-win32.zipÕâ¸öѹËõ°ü£¬°´ÕÕÍøÉϵݲװÅäÖúã¬ÈçÏ£º
    API
    ÔÚjavax.commÏÂÓÐ13¸öÀàºÍ½Ó¿Ú£¬·Ö±ðÊÇ
    4¸ö½Ó¿Ú
    CommDriver ¿É¸ºÔØÉ豸£¨the loadable device£©Çý¶¯³ ......

java ¸ù¾ÝÁ½µã¾­Î³¶ÈÀ´Ëã¾àÀë

package com.njty.util;
public class Test {
  private static final double EARTH_RADIUS = 6378137;
  private static double rad(double d)
     {
        return d * Math.PI / 180.0;
     }
     ......

java£ºÊÖд¶þ²æÊ÷BinaryTreeÌí¼ÓºÍ²éѯ·½·¨

package arrays.myArray;
public class BinaryTree {
 private Node root;
 // Ìí¼ÓÊý¾Ý
 public void add(int data) {
  // µÝ¹éµ÷ÓÃ
  if (null == root)
   root = new Node(data, null, null);
  else
   addTree(root, data);
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ