Vladimir Posted April 12, 2006 Report Share Posted April 12, 2006 Hi all, I have big array of clusters. I need effectively insert or delete middle elements. In my opinion linked list will be the right chose in C. What about labview ? I can use implementation via fixed size array of data elements and two arrays of integers represents previous and next pointers (in this case endexes to the data aray). But everything exists simpler more effective way, isn Quote Link to comment
JDave Posted April 12, 2006 Report Share Posted April 12, 2006 I have big array of clusters.I need effectively insert or delete middle elements. In my opinion linked list will be the right chose in C. What about labview ? I can use implementation via fixed size array of data elements and two arrays of integers represents previous and next pointers (in this case endexes to the data aray). But everything exists simpler more effective way, isn Quote Link to comment
Guillaume Lessard Posted April 12, 2006 Report Share Posted April 12, 2006 You are trying too hard to think in C. Just use the built-in functions. In the array palette you will find three native functions, "Replace Array Subset", "Insert Into Array" and "Delete From Array". These will provide the tools you need for that simpler more effective way. Those "native" VIs potentially require large amounts of memory allocation and/or copying. That is a problem whether in LabVIEW or in C or in java or anywhere else. When you're trying to do something fast, spurious memory allocations can easily kill your efficiency, and they're not that easy to prevent in LabVIEW. Many times it allocates blocks of memory in completely unnecessary places, but I haven't figured a way to convince it otherwise... that doesn't make things easy when doing RT work, for example. Vladimir: unless someone else replies with the perfect solution, try and test against your requirements. And what are the requirements? Less time? Less memory? Quote Link to comment
JDave Posted April 13, 2006 Report Share Posted April 13, 2006 Those "native" VIs potentially require large amounts of memory allocation and/or copying. That is a problem whether in LabVIEW or in C or in java or anywhere else. When you're trying to do something fast, spurious memory allocations can easily kill your efficiency, and they're not that easy to prevent in LabVIEW. Many times it allocates blocks of memory in completely unnecessary places, but I haven't figured a way to convince it otherwise... that doesn't make things easy when doing RT work, for example.Vladimir: unless someone else replies with the perfect solution, try and test against your requirements. And what are the requirements? Less time? Less memory? True. I didn't think of the memory allocation issues and I probably misunderstood the question. I agree that the static array with "replace array subset" is a good choice. Can't think of anything else in pure G. Quote Link to comment
Mike Ashe Posted April 13, 2006 Report Share Posted April 13, 2006 Several different ways you could approach this. If you really want to get fancy you could use templates and create an actual spawned linked list. If you use the array ideas suggested earlier, remember that the replace element doesn't change memory, only the add and delete, in which case I'd preallocate a large enough array and keep track of the available elements in a side array. Quote Link to comment
JDave Posted April 14, 2006 Report Share Posted April 14, 2006 Jim Kring talked about using clusters rather than separate arrays in this thread. Of course that would mean clusters within clusters.... But it is a twist on the same idea. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.