LinkedList前世今生

2021-05-22 06:04:28 字數 1064 閱讀 9492

1、linkedlist元素在內部儲存的實現,節點定義即指向前一元素的指標,後一元素的指標,當前元素的值。

private static class entry}

2、建立乙個空鍊錶。預設有個頭指標header。

private transient entryheader = new entry(null, null, null);

private transient int size = 0;

/*** constructs an empty list.

*/public linkedlist()

3、在鍊錶的末端新增乙個元素。

private entryaddbefore(e o, entrye)

4、刪除鍊錶中指定位置的元素。

/*** removes the element at the specified position in this list.  shifts any

* subsequent elements to the left (subtracts one from their indices).

* returns the element that was removed from the list.

** @param index the index of the element to removed.

* @return the element previously at the specified position.

** @throws indexoutofbound***ception if the specified index is out of

*           range (index < 0 || index >= size()).

*/public e remove(int index)

private e remove(entrye)

/*** return the indexed entry.

*/private entryentry(int index) else

return e;

}

前世今生 STL

嘛,string就是乙個用於字串處理的標準類庫,但是需要注意的是其速度可能會比直接操縱char陣列要慢一些。reverse這個方法是我一直都想找到但是沒有找到的,在判斷回文的時候格外好用。string s abcdef string ss s ss abcdef reverse ss.begin s...

位址 前世今生

alu arithemetic and logic unit 書面意思是 算術與邏輯部件,運算器,算術與邏輯單元,通俗來講 cpu處理的資料位數。從4位 8位 16位 32位,處理能力越來越強。發問 16位計算能力如何處理20位的位址呢?cs ip 是一組暫存器,用於告知 cpu 當前將要讀取的彙編...

Git前世今生

在linux之父 linus torvalds 納斯 托沃茲 創造linux誕生之後,他自己花了十年時間維護這個系統,後來各種熱愛開發的人員想要給linux提交bug,但是多個人共同提交bug維護起來不方便,所以git誕生了 乙個優秀的協同開發工具,據說linus開發git僅僅用了兩周,真正的大佬就...