Jump to content

Talk:Binary search tree

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by WikiLinuz (talk | contribs) at 22:55, 10 July 2023 (The currently misleading Deletion subsection: reply). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Template:Vital article

Good articleBinary search tree has been listed as one of the Engineering and technology good articles under the good article criteria. If you can improve it further, please do so. If it no longer meets these criteria, you can reassess it.
Article milestones
DateProcessResult
January 4, 2022Good article nomineeNot listed
April 11, 2022Good article nomineeNot listed
June 14, 2022Good article nomineeListed
Current status: Good article

The currently misleading Deletion subsection

I edited the Deletion subsection to highlight the three distinct cases. Previously, the text said "three cases" but listed five. Someone quickly reverted this change to show five cases again (while the text still says three cases), simply with the explanation that "last version was better". I beg to differ, as the text vs list is simply misleading and as a matter of preference, I claim that my edit was a good improvement over the reverted version.

Please clarify what makes the old version better. Qrwe~enwiki (talk) 22:31, 10 July 2023 (UTC)[reply]

Deletion does have three cases: (1) if a node have no children, (2) if a node have one children, and (3) if a node have two children. In case (3) have two cases: if the node to be deleted (call it X) have both left and right children, we try to find X's successor (call it Y), and if (3a) Y is X's right child we replace X by Y, but if (3b) Y lies within X's right subtree but not X's right child, we first replace Y by its own right child, then replace X with Y.
So, deletion itself have three cases (1), (2), and (3); but (3) have two cases within (3a) and (3b).
It ought to be indented -- I will make the changes. --WikiLinuz {talk} 22:55, 10 July 2023 (UTC)[reply]