From owner-freebsd-hackers@freebsd.org Sat Nov 26 16:38:34 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51300C57B12 for ; Sat, 26 Nov 2016 16:38:34 +0000 (UTC) (envelope-from emorrasg@yahoo.es) Received: from nm29-vm6.bullet.mail.ir2.yahoo.com (nm29-vm6.bullet.mail.ir2.yahoo.com [212.82.97.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C468F15D for ; Sat, 26 Nov 2016 16:38:33 +0000 (UTC) (envelope-from emorrasg@yahoo.es) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1480178198; bh=C1ctEnpFGUeowiS+S8PvrsLCxXnHDFw9tbkXeT5NGVA=; h=Date:From:To:Subject:In-Reply-To:References:From:Subject; b=XGFu45SOBEWrda66E5Pc9EQYsHiFa/Krw30cSFhK/U3HHH/vm9jndFpEWSSXwGPiZ/Wjf9J+wEBg6CpX3TnIW6ycvTCTVI1ClPXNo6mn9aLf9Pjv89aOEzLE1ox/Ij+BEdOxtV+SZrFCZevgZ8qn5gOvGRvb1dMJls6qOP+sba6MwFi8QXi9ucRqzFlc8ICbIR5vPDC2nu87DroCVGiV0yrAdYmMT2/XH7foGEqaEF4t1HOJcdoWRita8nUfkx+Ji31h8KIvVSsKxM79YGRVA28Y9e5U2tPoc49Eq7kifhvjmVEAV8SBzlXa1a4t00PcoDLEFO3Z+3VPrm32ryxsow== Received: from [212.82.98.49] by nm29.bullet.mail.ir2.yahoo.com with NNFMP; 26 Nov 2016 16:36:38 -0000 Received: from [46.228.39.71] by tm2.bullet.mail.ir2.yahoo.com with NNFMP; 26 Nov 2016 16:36:38 -0000 Received: from [127.0.0.1] by smtp108.mail.ir2.yahoo.com with NNFMP; 26 Nov 2016 16:36:38 -0000 X-Yahoo-Newman-Id: 457253.52451.bm@smtp108.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: meLUhngVM1nZ2nOCy6jvv0xtt4hhr2bBrTd_IK89CvbkB7J tM4SyK2MNmcFCDwW2Ytj8zUZNYe2AnMQ.j.z8pbT9U1vazoSrySFIcsXSNY9 cYmQJBhe.b_LxTvLIzkxrd7sj0a7jGgaBlfO4F65lIKA__iAuwWtA_NP.2QW 2wQajzMHI5koASw74Sh7YxcllrSBhStvo_FFt8VAYEDYXCNTdvifZHrYF8Rb B8VrBlqLY8gXPKhR4iaQoPJMm0I4GdGDcfB8.n4hYwFl5llTVJ690N03.uc5 7LKErQm6OgTkeSfIcmL8tJZiWQ_l5KpSY4RI1Y.3SdNbR6lKJiJGlj8l7MI7 azrIZFxBb_ChIxAARgcBMkJZjyGYzbroQAh5XDl7Rd.SPaMd47Ng09IvxGa0 cQ6PietKBHFt1RjxEORyH2xPX.RRbannk19mjuKvu6sC59w8m1dJcjCUuXnE 7HvXwVoJK5xvPIEd2ioden6bPDgYcZD_yS6iSqLfLeqmm4gr9_Wwd2khBn9C sjzFJY6JsrW5t9bb9Jw6znTDERXkyMAANbY3tOIk7QCBZIohq2g-- X-Yahoo-SMTP: mX392iiswBAeJNdO_s.EW62LZDJR Date: Sat, 26 Nov 2016 17:36:11 +0100 From: Eduardo Morras To: freebsd-hackers@freebsd.org Subject: Re: qsort switching to insertsort Message-Id: <20161126173611.52a55651c31beedf51f8cf71@yahoo.es> In-Reply-To: References: <0bfb49b0-5d24-2766-6982-b4e49b0d5e81@selasky.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Nov 2016 16:38:34 -0000 On Sat, 26 Nov 2016 06:35:53 -0800 Mehmet Erol Sanliturk wrote: > In quick sort , it is necessary to check worst case and switch to > another sort method if it is detected . > When this is not done , end result is stack overflow , etc . , but not > success . > Therefore , it is not possible to eliminate an alternative sort > method . And restricting the alternative sort for less than 40 elements (or other number)? It's common implementation to fallback to other sort algorithm, but doing so without restricting the number of elements can cause on corner cases, sorting all elements with alternative sort, which is bad. > > Mehmet Erol Sanliturk --- --- Eduardo Morras