Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #49453

Re: Implementing binary search without going deeper than top 2 items on stack?

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: Implementing binary search without going deeper than top 2 items on stack?
Date 2016-07-25 01:00 -0700
Organization A noiseless patient Spider
Message-ID <87bn1m9mfk.fsf@jester.gateway.pace.com> (permalink)
References <5db2ff24-c31d-45a0-a4f9-6b0515203925@googlegroups.com> <0f90531b-2852-477b-9ae6-0f6617ce6366@googlegroups.com> <7fad0dc9-9653-4842-9d15-cf9bcc7e5eb9@googlegroups.com> <2ca46317-a58c-4c68-8784-8f0e7f84c39d@googlegroups.com> <85b1b78e-8c76-4c97-a325-c3d0fbec917f@googlegroups.com>

Show all headers | View raw


Alex Dowad <alexinbeijing@gmail.com> writes:
> Using only the top 2 items on the stack? What if you have an
> algorithm which, by its nature, operates on 3 or more datums? The
> trick here was that you can also use the top of the retstack

Well there's a difference between having more than 2 items on the stack
during the algorithm, and having to juggle the stack around to reach
them.  E.g. I'd expect quicksort to look something like

 : qsort ( begin end -- ) partition ( begin pivot pivot end )
   recurse ( begin pivot ) recurse ;

partition would be factored into a forward-scanning word and a
backward-scanning one, etc.

Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Implementing binary search without going deeper than top 2 items on stack? Alex Dowad <alexinbeijing@gmail.com> - 2016-07-24 10:41 -0700
  Re: Implementing binary search without going deeper than top 2 items on stack? Paul Rubin <no.email@nospam.invalid> - 2016-07-24 11:18 -0700
  Re: Implementing binary search without going deeper than top 2 items on stack? Brad Eckert <hwfwguy@gmail.com> - 2016-07-24 13:23 -0700
    Re: Implementing binary search without going deeper than top 2 items on stack? Alex Dowad <alexinbeijing@gmail.com> - 2016-07-24 23:10 -0700
      Re: Implementing binary search without going deeper than top 2 items on stack? humptydumpty <ouatubi@gmail.com> - 2016-07-24 23:28 -0700
      Re: Implementing binary search without going deeper than top 2 items on stack? Julian Fondren <ayrnieu@gmail.com> - 2016-07-25 00:08 -0700
        Re: Implementing binary search without going deeper than top 2 items on stack? Alex Dowad <alexinbeijing@gmail.com> - 2016-07-25 00:29 -0700
          Re: Implementing binary search without going deeper than top 2 items on stack? Paul Rubin <no.email@nospam.invalid> - 2016-07-25 01:00 -0700
      Re: Implementing binary search without going deeper than top 2 items on stack? Brad Eckert <hwfwguy@gmail.com> - 2016-07-25 09:36 -0700
      Re: Implementing binary search without going deeper than top 2 items on stack? hughaguilar96@gmail.com - 2016-07-25 10:11 -0700
  Re: Implementing binary search without going deeper than top 2 items on stack? Alex Dowad <alexinbeijing@gmail.com> - 2016-07-25 01:10 -0700
    Re: Implementing binary search without going deeper than top 2 items on stack? humptydumpty <ouatubi@gmail.com> - 2016-07-25 01:32 -0700
      Re: Implementing binary search without going deeper than top 2 items on stack? humptydumpty <ouatubi@gmail.com> - 2016-07-25 09:48 -0700
        Re: Implementing binary search without going deeper than top 2 itemson stack? "WJ" <w_a_x_man@yahoo.com> - 2016-07-25 21:49 +0000
      Re: Implementing binary search without going deeper than top 2 items on stack? hughaguilar96@gmail.com - 2016-07-25 12:15 -0700
        Re: Implementing binary search without going deeper than top 2 items on stack? humptydumpty <ouatubi@gmail.com> - 2016-07-26 00:40 -0700
          Re: Implementing binary search without going deeper than top 2 items on stack? hughaguilar96@gmail.com - 2016-07-28 15:11 -0700
            Re: Implementing binary search without going deeper than top 2 items on stack? hughaguilar96@gmail.com - 2016-07-30 22:47 -0700
        Re: Implementing binary search without going deeper than top 2 items on stack? josv@planet.nl - 2016-07-26 01:53 -0700
      Re: Implementing binary search without going deeper than top 2 items on stack? mhx@iae.nl - 2016-07-30 21:31 -0700
        Re: Implementing binary search without going deeper than top 2 items on stack? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-31 05:49 +0000
          Re: Implementing binary search without going deeper than top 2 items on stack? mhx@iae.nl - 2016-07-31 00:17 -0700
            Re: Implementing binary search without going deeper than top 2 items on stack? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-31 13:13 +0000
  Re: Implementing binary search without going deeper than top 2 items on stack? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-07-25 07:51 +0000
    Re: Implementing binary search without going deeper than top 2 items on stack? "Elizabeth D. Rather" <erather@forth.com> - 2016-07-24 22:48 -1000
    Re: Implementing binary search without going deeper than top 2 items on stack? hughaguilar96@gmail.com - 2016-07-25 10:02 -0700
      Re: Implementing binary search without going deeper than top 2 items on stack? humptydumpty <ouatubi@gmail.com> - 2016-07-25 10:10 -0700
  Re: Implementing binary search without going deeper than top 2 items on stack? Alex Dowad <alexinbeijing@gmail.com> - 2016-07-26 22:56 -0700
  Re: Implementing binary search without going deeper than top 2 items on stack? lehs <skydda.barnen@gmail.com> - 2016-07-30 23:28 -0700
    Re: Implementing binary search without going deeper than top 2 items on stack? hughaguilar96@gmail.com - 2016-07-31 00:19 -0700
      Re: Implementing binary search without going deeper than top 2 items on stack? lehs <skydda.barnen@gmail.com> - 2016-07-31 00:31 -0700

csiph-web