From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andreas Politz Newsgroups: gmane.emacs.devel Subject: Re: Overlay tree. Stuck again Date: Fri, 03 Feb 2017 09:28:00 +0100 Message-ID: <87poizsmpb.fsf@hochschule-trier.de> References: <874m14rnl7.fsf@fastmail.com> <83eg07cr91.fsf@gnu.org> <87ziivqilc.fsf@fastmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486111828 27114 195.159.176.226 (3 Feb 2017 08:50:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Feb 2017 08:50:28 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Joakim Jalap Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 03 09:50:24 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZZZX-0006vw-Mf for ged-emacs-devel@m.gmane.org; Fri, 03 Feb 2017 09:50:23 +0100 Original-Received: from localhost ([::1]:60889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZZZd-0002wU-4L for ged-emacs-devel@m.gmane.org; Fri, 03 Feb 2017 03:50:29 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZZDz-00027f-Qy for emacs-devel@gnu.org; Fri, 03 Feb 2017 03:28:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZZDz-0006E3-43 for emacs-devel@gnu.org; Fri, 03 Feb 2017 03:28:07 -0500 Original-Received: from gateway-a.fh-trier.de ([143.93.54.181]:44522) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZZDu-0006A5-MS; Fri, 03 Feb 2017 03:28:02 -0500 X-Virus-Scanned: by Amavisd-new + McAfee uvscan + ClamAV [Rechenzentrum Hochschule Trier (RZ/HT)] Original-Received: from localhost (ip5f5bdfbc.dynamic.kabel-deutschland.de [95.91.223.188]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: politza) by gateway-a.fh-trier.de (Postfix) with ESMTPSA id 28D61179ABA3; Fri, 3 Feb 2017 09:28:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=hochschule-trier.de; s=default; t=1486110481; bh=+FZNtHEFMl3IhkdRjLvZ3Q3KsUU=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=m6wxsHvF0n/RmRUjaq/LOOBa4qpQv1lpUxRn1vzb3fJQkGky1vu9Yi+CO5viMbL/D kXX1G56xNidDdXghCtmM441M6jcaTE7+vWEdF+YqXQJPl/F77MEw2qoZYkgrmOFVC0 3UWsxSF+naYXdZHovLPhWepb6IykW+RROcOGzZe8= In-Reply-To: <87ziivqilc.fsf@fastmail.com> (Joakim Jalap's message of "Fri, 13 Jan 2017 12:56:15 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 143.93.54.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:211917 Archived-At: Joakim Jalap writes: > Eli Zaretskii writes: >> [...] try removing them from the tree, and then re-adding them [...] > > Yes, that is the "big hammer" approach :) I hae thought about it, but I > think the problem is that it will be too expensive. [...] Joakim, I think that trying to somehow manually fix the disorder is at least as expensive as a deletion and reinsertion. Because if it weren't you would have essentially discovered a better algorithm for balancing trees then the one you've got. The trick is probably to gather the dirty nodes in post-order and delete them all at once. This way you're only removing a node, if its corresponding sub-tree is in order. After that you're free to reinsert them again. -ap