I wanted to see if it was possible to have an implementation without classes or references.
The ideal type would be a cluster with two elements, a value, and a singly linked list but if you try and do that the IDE throws an error about not being able to have recursive data types. Instead, we can just use a variant for the "next" element
And here's how you can link them. You can see from the indicator that all the data is in there:
We can also implement other functions like print, insert, append to other side, reverse list, sort etc:
Here's what sort looks like:
Things that would be nice to have for future work:
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
Thank you for the feedback!
I was trying to follow this type of linked list. By using swap values, you should be able different lists and link them back together without copying. You'll notice that in bubble, everything is done on the shift register and ideally, should be "in place". If I'm mistaken here, let me know.
If you think recursive data structures should exist without the variant, please kudos the idea. I think it will enable users to advance what can be made in LabVIEW.