亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? arrayheap.java

?? Standord Classifier實現(xiàn)了一個基于Java的最大熵分類器。用于模式識別
?? JAVA
字號:
package edu.stanford.nlp.util;import java.util.*;/** *  ArrayHeap: * *  Heap implementation.  Values are all implicit in the comparator *  passed in on construction.  Decrease key is supported, though only *  lg(n).  Unlike the previous implementation of this class, this *  heap interprets the addition of an existing element as a "change *  key" which gets ignored unless it actually turns out to be a *  decrease key.  Note that in this implementation, changing the key *  of an object should trigger a change in the comparator's ordering *  for that object, but should NOT change the equality of that *  object. * *  @author Dan Klein *  @author Christopher Manning *  @version 1.2, 07/31/02 */public class ArrayHeap extends AbstractSet implements Heap {  /**   * A <code>HeapEntry</code> stores an object in the heap along with   * its current location (array position) in the heap.   *   * @author <a href="mailto:klein@cs.stanford.edu">Dan Klein</a>   * @version 1.2   */  private final class HeapEntry {    public Object object;    public int index;  }  /**   * <code>indexToEntry</code> maps linear array locations (not   * priorities) to heap entries.   */  private ArrayList indexToEntry;  /**   * <code>objectToEntry</code> maps heap objects to their heap   * entries.   */  private Map objectToEntry;  /**   * <code>cmp</code> is the comparator passed on construction.   */  private Comparator cmp;  // Primitive Heap Operations  private int parent(final int index) {    return (index-1)/2;  }  private int leftChild(final int index) {    return index*2+1;  }  private int rightChild(final int index) {    return index*2+2;  }  private HeapEntry parent(HeapEntry entry) {    int index = entry.index;    return (index > 0 ? (HeapEntry)indexToEntry.get((index-1)/2) : null);  }  private HeapEntry leftChild(HeapEntry entry) {    int index = entry.index;    int leftIndex = index*2+1;    return (leftIndex < size() ? (HeapEntry)indexToEntry.get(leftIndex) : null);  }  private HeapEntry rightChild(HeapEntry entry) {    int index = entry.index;    int rightIndex = index*2+2;    return (rightIndex < size() ? (HeapEntry)indexToEntry.get(rightIndex) : null);  }  private int compare(HeapEntry entryA, HeapEntry entryB) {    return cmp.compare(entryA.object, entryB.object);  }  private void swap(HeapEntry entryA, HeapEntry entryB) {    int indexA = entryA.index;    int indexB = entryB.index;    entryA.index = indexB;    entryB.index = indexA;    indexToEntry.set(indexA,entryB);    indexToEntry.set(indexB,entryA);  }  /**   * Remove the last element of the heap (last in the index array).   * Do not call this on other entries; the last entry is only passed   * in for efficiency.   *   * @param entry the last entry in the array   */  private void removeLast(HeapEntry entry) {    indexToEntry.remove(entry.index);    objectToEntry.remove(entry.object);  }  private HeapEntry getEntry(Object o) {    HeapEntry entry = (HeapEntry)objectToEntry.get(o);    if (entry == null) {      entry = new HeapEntry();      entry.index = size();      entry.object = o;      indexToEntry.add(entry);      objectToEntry.put(o,entry);    }    return entry;  }  /** iterative heapify up: move item o at index up until correctly placed   */  private int heapifyUp(HeapEntry entry) {    int numSwaps = 0;    while (true) {      if (entry.index == 0)	break;      HeapEntry parentEntry = parent(entry);      if (compare(entry,parentEntry) >= 0)	break;      numSwaps++;      swap(entry,parentEntry);    }    return numSwaps;  }  /** On the assumption that   *  leftChild(entry) and rightChild(entry) satisfy the heap property,   *  make sure that the heap at entry satisfies this property by possibly   *  percolating the element o downwards.  I've replaced the obvious    *  recursive formulation with an iterative one to gain (marginal) speed   */  private void heapifyDown(HeapEntry entry) {    int size = size();    HeapEntry currentEntry = entry;    HeapEntry minEntry = null;    do {      minEntry = currentEntry;      HeapEntry leftEntry = leftChild(currentEntry);      if (leftEntry != null) {	if (compare(minEntry, leftEntry) > 0) {	  minEntry = leftEntry;	}      }      HeapEntry rightEntry = rightChild(currentEntry);      if (rightEntry != null) {	if (compare(minEntry, rightEntry) > 0) {	  minEntry = rightEntry;	}      }      if (minEntry != currentEntry) {	// Swap min and current	swap(minEntry, currentEntry);	// at start of next loop, we set currentIndex to largestIndex	// this indexation now holds current, so it is unchanged      }    } while (minEntry != currentEntry);    // System.err.println("Done with heapify down");    // verify();  }  /**   * Finds the object with the minimum key, removes it from the heap,   * and returns it.   *   * @return the object with minimum key   */  public Object extractMin() {    if (isEmpty())      throw new NoSuchElementException();    HeapEntry minEntry = (HeapEntry)indexToEntry.get(0);    int lastIndex = size()-1;    if (lastIndex > 0) {      HeapEntry lastEntry = (HeapEntry)indexToEntry.get(lastIndex);      swap(lastEntry,minEntry);      removeLast(minEntry);      heapifyDown(lastEntry);    } else {      removeLast(minEntry);    }    return minEntry.object;  }  /**   * Finds the object with the minimum key and returns it, without   * modifying the heap.   *   * @return the object with minimum key   */  public Object min() {    HeapEntry minEntry = (HeapEntry)indexToEntry.get(0);    return minEntry.object;  }  /**   * Adds an object to the heap.  If the object is already in the heap   * with worse score, this acts as a decrease key.  If the object is   * already present, with better score, it will NOT cause an   * "increase key".   *   * @param o an <code>Object</code> value   */  public boolean add(Object o) {    decreaseKey(o);    return true;  }  /**   * Changes the position of an element o in the heap based on a   * change in the ordering of o.  If o's key has actually increased,   * it will do nothing, particularly not an "increase key".   *   * @param o an <code>Object</code> value   * @return the number of swaps done on decrease.   */  public int decreaseKey(Object o) {    HeapEntry entry = getEntry(o);    if (o != entry.object)      if (cmp.compare(o, entry.object) < 0)	entry.object = o;    return heapifyUp(entry);  }  /**   * Checks if the heap is empty.   *   * @return a <code>boolean</code> value   */  public boolean isEmpty() {    return indexToEntry.isEmpty();  }  /**   * Get the number of elements in the heap.   *   * @return an <code>int</code> value   */  public int size() {    return indexToEntry.size();  }  public Iterator iterator() {    Heap tempHeap = new ArrayHeap(cmp, size());    List tempList = new ArrayList(size());    for (Iterator i = objectToEntry.keySet().iterator(); i.hasNext();) {      tempHeap.add(i.next());    }    while (! tempHeap.isEmpty()) {      tempList.add(tempHeap.extractMin());    }    return tempList.iterator();  }  /**   * Clears the heap.  Equivalent to calling extractMin repeatedly   * (but faster).   *   */  public void clear() {    indexToEntry.clear();    objectToEntry.clear();   }  public void dump() {    for (int j = 0; j < indexToEntry.size(); j++) {      System.err.println(" "+j+" "+((Scored)((HeapEntry)indexToEntry.get(j)).object).score());    }  }  public void verify() {    for (int i = 0; i < indexToEntry.size(); i++) {      if (i != 0) {	// check ordering	if (compare((HeapEntry)indexToEntry.get(i), (HeapEntry)indexToEntry.get(parent(i))) < 0) {	  System.err.println("Error in the ordering of the heap! ("+i+")");	  dump();	  System.exit(0);	}      }      // check placement      if (i != ((HeapEntry)indexToEntry.get(i)).index)	System.err.println("Error in placement in the heap!");    }  }  /** The objects added will be ordered using the <code>Comparator</code>.   */  public ArrayHeap(Comparator cmp) {    this.cmp = cmp;    indexToEntry = new ArrayList();    objectToEntry = new HashMap();  }  public ArrayHeap(Comparator cmp, int initCapacity) {    this.cmp = cmp;    indexToEntry = new ArrayList(initCapacity);    objectToEntry = new HashMap(initCapacity);  }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久婷婷国产综合精品| 一区二区三区在线播| 国产精品三级视频| 亚洲精品福利视频网站| 日韩不卡一区二区三区| 国产乱子轮精品视频| 99久久99久久免费精品蜜臀| 欧美日韩mp4| 久久久激情视频| 亚洲一区二区三区激情| 国产最新精品免费| 99精品热视频| 日韩一卡二卡三卡四卡| 久久久777精品电影网影网| 亚洲欧美在线aaa| 日韩和欧美的一区| 丰满亚洲少妇av| 欧美影院一区二区| 精品国产3级a| 亚洲精品视频在线看| 久久精品国产免费| 色88888久久久久久影院按摩 | 中文字幕日韩一区二区| 日日夜夜精品视频免费| 成人avav影音| 日韩午夜在线观看| 亚洲女与黑人做爰| 久久激情五月婷婷| 欧洲中文字幕精品| 欧美激情中文字幕一区二区| 日韩激情在线观看| 色婷婷久久久久swag精品| 日韩丝袜情趣美女图片| 亚洲欧美另类小说| 国产乱子伦视频一区二区三区| 欧美日韩一级片在线观看| 国产精品久久久久影院色老大| 蓝色福利精品导航| 欧美在线播放高清精品| 国产日韩欧美高清在线| 免费在线看成人av| 91在线小视频| 中文字幕欧美日本乱码一线二线| 日本中文一区二区三区| 色婷婷久久久亚洲一区二区三区| 欧美国产国产综合| 国产制服丝袜一区| 日韩欧美亚洲另类制服综合在线| 亚洲国产一区二区三区青草影视| 不卡区在线中文字幕| 久久久精品天堂| 久久精品国产精品青草| 91精品国产欧美一区二区成人 | 一色屋精品亚洲香蕉网站| 久久精品久久精品| 91麻豆精品国产自产在线| 亚洲精品乱码久久久久久黑人| 国产成人av一区二区三区在线| 日韩三级在线观看| 日韩精品免费视频人成| 欧美日韩精品一区二区三区四区 | 不卡av在线免费观看| 国产丝袜美腿一区二区三区| 免费的成人av| 69p69国产精品| 石原莉奈在线亚洲三区| 欧美三电影在线| 一区二区三区精品视频在线| 91网站最新地址| 亚洲欧洲韩国日本视频| 成人免费观看视频| 国产精品三级视频| www.欧美日韩| 中文字幕亚洲一区二区va在线| 成人午夜电影网站| 国产精品高潮久久久久无| 成人网页在线观看| 中文字幕色av一区二区三区| 99久久er热在这里只有精品15 | 色综合色综合色综合色综合色综合 | 不卡电影一区二区三区| 国产精品视频第一区| 成人深夜在线观看| 中文字幕一区二区三区乱码在线| 99久久99久久免费精品蜜臀| 亚洲色图清纯唯美| 日本精品免费观看高清观看| 亚洲精品高清在线观看| 欧美性三三影院| 午夜私人影院久久久久| 在线成人小视频| 久久精品国产999大香线蕉| 2021久久国产精品不只是精品 | 中文av一区二区| 成人动漫一区二区三区| 亚洲另类色综合网站| 欧美三电影在线| 开心九九激情九九欧美日韩精美视频电影| 精品国产sm最大网站| 国产91丝袜在线观看| ㊣最新国产の精品bt伙计久久| 91蝌蚪porny| 日韩国产精品久久久| 久久一日本道色综合| 成人免费av资源| 亚洲一二三区视频在线观看| 91精品国产综合久久香蕉麻豆| 韩国成人在线视频| 最新成人av在线| 欧美精品tushy高清| 国产一区不卡视频| 亚洲日本va在线观看| 精品视频色一区| 久久99国产精品久久| 亚洲欧洲日产国码二区| 欧美人伦禁忌dvd放荡欲情| 极品少妇一区二区三区精品视频| 国产精品免费观看视频| 欧美日韩你懂得| 国产河南妇女毛片精品久久久 | 欧美中文一区二区三区| 久久se这里有精品| 亚洲欧洲成人自拍| 91精品国产综合久久久久久久| 国产成人精品一区二区三区四区| 一区二区三区精品在线| 精品国产伦理网| 色噜噜久久综合| 久久狠狠亚洲综合| 亚洲人xxxx| 欧美mv日韩mv国产网站app| 91免费版在线看| 精品一区二区三区免费| 亚洲视频电影在线| 日韩欧美国产一区二区三区| 91在线国产观看| 九九视频精品免费| 亚洲国产中文字幕| 中文字幕精品综合| 欧美一二三四在线| 色999日韩国产欧美一区二区| 精品一区二区三区在线视频| 亚洲精品写真福利| 国产喷白浆一区二区三区| 欧美少妇bbb| 北条麻妃国产九九精品视频| 久久精品免费看| 视频精品一区二区| 亚洲精品综合在线| 国产无一区二区| 日韩一区二区三区视频| 欧美主播一区二区三区| 成人激情黄色小说| 韩国中文字幕2020精品| 午夜视频一区二区| 亚洲自拍偷拍综合| 亚洲欧美日韩国产一区二区三区| 国产日韩欧美一区二区三区乱码 | 毛片av中文字幕一区二区| 亚洲欧美日韩国产综合在线| 国产性天天综合网| 精品日韩一区二区| 欧美一三区三区四区免费在线看| 91国内精品野花午夜精品| 成人久久视频在线观看| 国产一区二区剧情av在线| 男女性色大片免费观看一区二区| 亚洲一区二区四区蜜桃| 亚洲免费av高清| 日韩伦理电影网| 国产精品久久久久久久久晋中 | 国产在线不卡一卡二卡三卡四卡| 日韩vs国产vs欧美| 亚洲v日本v欧美v久久精品| 亚洲欧洲制服丝袜| 亚洲欧美日韩电影| 国产精品电影一区二区三区| 国产欧美日韩综合| 久久夜色精品国产欧美乱极品| 日韩欧美电影在线| 日韩一区二区影院| 日韩欧美一级在线播放| 欧美一级精品在线| 日韩欧美精品三级| 日韩欧美国产1| 久久综合狠狠综合久久综合88| 精品美女一区二区三区| 精品国产1区2区3区| 精品99一区二区| 久久久综合精品| 国产视频视频一区| 国产精品欧美久久久久无广告 | 91在线丨porny丨国产| 91免费在线看| 91福利在线看| 欧美乱熟臀69xxxxxx| 欧美一级片在线| 久久在线免费观看| 中文欧美字幕免费| 亚洲天堂成人在线观看|