Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #40552
| Path | csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Array object sorted on time, how to deal with. |
| Date | Tue, 23 Nov 2021 11:22:36 +0000 |
| Organization | A noiseless patient Spider |
| Lines | 31 |
| Message-ID | <878rxff75v.fsf@bsb.me.uk> (permalink) |
| References | <dcf606f5-10c9-432c-aee1-152d5fd997ban@googlegroups.com> <daf9ffa9-4e7a-43ba-aac6-69c655253e59n@googlegroups.com> <571380ac-a926-4bf2-88b2-a8a49b77a1bdn@googlegroups.com> <5dccbec9-7025-455d-96ef-5f5bc1fa4fe8n@googlegroups.com> <58bcaa57-860b-472f-9870-73e6551e7a48n@googlegroups.com> <daf4b01a-066d-461f-8291-712fc31ac8d8n@googlegroups.com> <6ee13397-3a3f-4ad5-8d46-8f9eb85debd8n@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain |
| Injection-Info | reader02.eternal-september.org; posting-host="8eb52a1cb63455e5c0003813e8c7219d"; logging-data="15959"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/TibK1r1kVxOYTmaCBCO36Vo4B6z5hsKQ=" |
| Cancel-Lock | sha1:O7cbYzHovbF/SENsH4Slbt3UsXY= sha1:J2uPf2WxknWEncQNLzQPZO2yaZo= |
| X-BSB-Auth | 1.55eca9fb9167b6301ec2.20211123112236GMT.878rxff75v.fsf@bsb.me.uk |
| Xref | csiph.com comp.lang.javascript:40552 |
Show key headers only | View raw
luserdroog <luser.droog@gmail.com> writes:
> With a priority queue, at least the ones I looked at, when you create the
> queue you pass an ordering function to the constructor. It uses that function
> to figure out how to keep your data in order without knowing anything else
> about your data. So you can fill it with records and it'll keep everything in
> a sorted order, you just have to tell it how to sort 2 of your things.
For an abstract priority queue (in the strictest sense) you don't need
to keep the queue sorted.
I went on the write "In fact, one common implementation uses a heap, as
in heap sort" but then I looked at your link and that uses a heap! I
would not say that the data in a heap are in sorted order, though it's
almost a philosophical point.
However, if you need this:
> //then when you click play, you can get an array of everything
> //in order and run through converting each note to midi events.
>
> function getNotesArray(){
> return notesQueue.toArray()
> }
Then it might pay (depending on how the notes are generated) to maintain
a sorted array. But why is a sorted array needed? Can't whatever uses
this queue simply pull the notes off one at a time?
--
Ben.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-10-26 01:44 -0700
Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-10-26 01:48 -0700
Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-11-05 00:48 -0700
Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-19 17:59 -0800
Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-20 20:41 -0800
Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-11-21 04:28 -0800
Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-22 20:36 -0800
Re: Array object sorted on time, how to deal with. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-11-23 11:22 +0000
Re: Array object sorted on time, how to deal with. The Natural Philosopher <tnp@invalid.invalid> - 2021-11-23 12:23 +0000
Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-25 18:05 -0800
Re: Array object sorted on time, how to deal with. John Harris <niam@jghnorth.org.uk.invalid> - 2021-11-26 18:18 +0000
Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-26 16:02 -0800
Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-25 18:17 -0800
Re: Array object sorted on time, how to deal with. Richard Damon <Richard@Damon-Family.org> - 2021-11-25 22:27 -0500
Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-25 20:14 -0800
Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-11-25 21:02 -0800
Re: Array object sorted on time, how to deal with. luserdroog <luser.droog@gmail.com> - 2021-11-26 16:18 -0800
Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-11-25 20:41 -0800
Re: Array object sorted on time, how to deal with. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-11-25 21:06 -0800
csiph-web