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:27:36 +0100 Message-ID: <87r33fsmpz.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 1486111279 15861 195.159.176.226 (3 Feb 2017 08:41:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Feb 2017 08:41:19 +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:41:11 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 1cZZQd-0003oU-HQ for ged-emacs-devel@m.gmane.org; Fri, 03 Feb 2017 09:41:11 +0100 Original-Received: from localhost ([::1]:60838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZZQj-0003fo-1A for ged-emacs-devel@m.gmane.org; Fri, 03 Feb 2017 03:41:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZZDp-0001wz-PE for emacs-devel@gnu.org; Fri, 03 Feb 2017 03:27:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZZDp-000687-4m for emacs-devel@gnu.org; Fri, 03 Feb 2017 03:27:57 -0500 Original-Received: from gateway-a.fh-trier.de ([143.93.54.181]:44499) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cZZDk-00066q-GW; Fri, 03 Feb 2017 03:27:52 -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 DD9B2179ABCD; Fri, 3 Feb 2017 09:27:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=simple/simple; d=hochschule-trier.de; s=default; t=1486110457; bh=+FZNtHEFMl3IhkdRjLvZ3Q3KsUU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=Tba3bosMaVqETDstIMIhNzJ05MRPDqiCOQXKD6kHiRHYKX1LI5bXa/D2lgJ0T4Hc2 mX+K77bEDgTcSWeZCBayPjfLSPIFcZ22U4W9RVnUUJHCU9EyiHQ851XxGqxPi26Htd 6xiDOu5RybnR/xbRfUXDv6uCX5MKxYUQGOlqO/IE= 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:211915 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