|
From: | Kristian Lein-Mathisen |
Subject: | Re: [Chicken-users] Two dimensional linked lists |
Date: | Sun, 11 Sep 2016 23:49:40 +0200 |
A vector of vectors would be more efficient to traverse for large values of [n], but if the vectors are not the same length you need to check to make sure index [n] exists in each one. If you are going to handle random insertions of data you also have to worry about growing a vector(s) if the requested [n] is larger than the vector size.A simple and elegant (though perhaps not the most efficient?) solution is to use a hashtable to store the cell values:This example is in Python but you get the idea:Thanks,JustinOn Thu, Sep 8, 2016 at 7:07 AM, mfv <address@hidden> wrote:Hi,
what would be the best way to implement two dimensional linked lists into
Scheme? I was thinking about fooling around with spreadsheet calculations in
Scheme, but it seems to me tha there are not proper data structures for it
here.
As I understand, making linked lists from linked lists will create a
structure that can not be traverse efficiently in all directions:
With the structure being
(list (list-A) (list-B) (...) (list-Z) (list-AA))
it would be trivial to quick to traverse from A[0] to A[n], but long to
get to A[n] to B[n].
Would the same thing apply to vectors?
Regards,
mfv
_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-users
_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-users
[Prev in Thread] | Current Thread | [Next in Thread] |