At the risk of repeating much of what Raul said, here are some short
versions of answers to your questions:
1. Using a list like
1 2 3 4
a pointer to the last element could be "_1{" .
2. see 1 above and Raul's reply - it's not clear why these elements need to
be nested.
3. You could build some kind of hashmap if you needed it but, as with
linked-lists, this is usually a means to an end, not an end in itself. If
you have an example of what you're trying to accomplish with a hashmap (or
a linked list), there's either a simpler way to accomplish it in J or an
interesting problem for the forum to ponder.
On Sat, Feb 16, 2013 at 4:42 PM, Raul Miller <[email protected]> wrote:
> It's worth talking about, I think, the distinction between a "linked
> list" and a "list".
>
> First, why would you prefer a linked list over a list? Efficiency?
> If so, note that regular lists can have performance an order of
> magnitude better than linked lists in many contexts. The efficiency
> of linked lists comes into play when your algorithms are designed to
> be efficient for a linked list and inefficient for a flat list.
>
> Hashes are similar, but even more complex (as a general rule, hashes
> have extremely bad worst case behavior, and there have been a variety
> of denial of service attacks for web servers because of this issue -
> nowadays, a robust web server randomizes its hashing algorithm to make
> it hard to guess how to break it).
>
> In other words, both of these are typically examples of complex
> solutions - it's probably a mistake to start here, and probably wiser
> to start with specific applications. (Though, if your applications
> are simply designed to require these kinds of data structures, it's
> not clear why you would be using J to implement them.)
>
> Or... that's my current understanding of these issues.
>
> FYI,
>
> --
> Raul
>
> On Sat, Feb 16, 2013 at 12:57 PM, Y-01 <[email protected]> wrote:
> > hi@all
> >
> > I have some basic questions on which i can't find any answers
> >
> > 1. How we can create a linked list with push_back complexity =~ O(1) in
> J ?
> > we need to save a poinet to last element
> >
> > 2. is it right that these examples correspond to linked lists?
> >
> > 1;<2
> > 1;<(2;<3)
> > 1;<(2;<(3;<4))
> >
> > 3. And what about hashmap? Is it right that there is no any builtined
> > hashmap struct? Maybe there is a popular aside addon/lib (smth like
> > hash.ijs) ?
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm