Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Slurping a file
- X-seq: zsh-users 29475
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: Slurping a file
- Date: Sun, 14 Jan 2024 16:41:49 +0100
- Archived-at: <https://zsh.org/users/29475>
- In-reply-to: <b8327430-bea5-4fea-aa68-851cd9b2c821@eastlink.ca>
- List-id: <zsh-users.zsh.org>
- References: <ca1761f1-6d8f-452a-b16d-2bfce9076e25@eastlink.ca> <CAH+w=7ZJsr7hGRvD8f-wUogPcGt0DMOcPyiYMpcwCsbBNkRwuQ@mail.gmail.com> <CAA=-s3zc5a+PA7draaA=FmXtwU9K8RrHbb70HbQN8MhmuXTYrQ@mail.gmail.com> <CAH+w=7bAWOF-v36hdNjaxBB-5rhjsp97mAtyESyR2OcojcEFUQ@mail.gmail.com> <205735b2-11e1-4b5e-baa2-7418753f591f@eastlink.ca> <CAH+w=7Y5_oQL20z7mkMUGSLnsdc9ceJ3=QqdAHVRF9jDZ_hZoQ@mail.gmail.com> <CAA=-s3x4nkLST56mhpWqb9OXUQR8081ew63p+5sEsyw5QmMdpw@mail.gmail.com> <CAH+w=7Yi+M1vthseF3Awp9JJh5KuFoCbFjLa--a22BGJgEJK_g@mail.gmail.com> <CAN=4vMpexntEq=hZcmsiXySy-2ptXMvBKunJ1knDkkS+4sYYLA@mail.gmail.com> <CAH+w=7aT-gbt7PRo=uvPK5=+rR3X-PE7nEssOkh+=fxwdeG_7w@mail.gmail.com> <CAN=4vMq=E4s2a0sDFq-Mc8=pVzPnYOM9NaTmesgXQqi+O+mHpw@mail.gmail.com> <b8327430-bea5-4fea-aa68-851cd9b2c821@eastlink.ca>
On Sun, Jan 14, 2024 at 4:37 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> On 2024-01-14 02:34, Roman Perepelitsa wrote:
>
> > Indeed, this would be faster but the code would still have quadratic time complexity. Here's a version with linear time complexity:
>
> Quadratic? In this kind of situation I'd understand linear, geometric and exponential. What's quadratic?
O(n^2) where n is the file size.
> main[hilighted]= # Don't even think about doing this!
>
> ... I've noticed that if initializing an A array, there *must* be a value otherwise the pairs go out of whack.
You must be using `print $main` to see what's going on. Use a better tool.
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author