常見例句Problem :Given a singly linked list, find the middle of the list. 單鏈表上的花樣是很多的,很多問題不用些奇淫巧技是不成的。Singly linked lists are a powerful abstraction that allow you to represent numerous types of data. 單鏈表是讓您可以描述多種類型數(shù)據(jù)的一種有效抽象。If a binary tree becomes degenerate, we run into the same efficiency problems as we did with the singly linked list. 如果二叉樹變得很不平衡,我們將會(huì)碰到同樣的效率問題如同在持久化單向鏈表是一樣。Using a singly linked list saves the overhead of updating an additional pointer for all operations as well as the memory for that pointer. 使用單向鏈接表可省去更新所有操作的附加指針以及該指針的內(nèi)存的系統(tǒng)開銷。This one was easy.Simply create a persistent singly linked list and limit insertions and deletions to the head of the list. 讓我們插入一個(gè)新的節(jié)點(diǎn)到這個(gè)鏈表中去,并且該鏈表是非持久化的,也就是說這個(gè)鏈表可以被改變而無需產(chǎn)生一個(gè)新的版本。Inserting a new item into a persistent singly linked list will not alter the existing list but create a new version with the item inserted into it. 如果插入一個(gè)新的節(jié)點(diǎn)到持久化的單向鏈表中,我們不應(yīng)該改變當(dāng)前鏈表的狀態(tài),而需要?jiǎng)?chuàng)建一個(gè)新的鏈表而后插入指定節(jié)點(diǎn)。 返回 singly-linked