October 14, 2016, 11:25am
I found these beautiful sorting algorithms:
… and try to patch one of them.
So since I am new to v4 (first post here :), its hard to get the logic done. basically I need a condition within a loop and a counter of course to swap the spread in the right order.
in textual programming you would do it like this:
swapped = false
for i = 1 to indexOfLastUnsortedElement
if leftElement > rightElement
swapped = true; swapCounter++
I attached my patch, but its still a long way to go :D
sorting_algo.v4p (18.9 kB)
October 14, 2016, 1:29pm
insert some devvvv comment about VL beeing your saviour someday in the future.
October 14, 2016, 6:00pm
hi _e, as guest already noticed, this is totally a
in vvvv FOR loops are implicitly integrated into the nodes and you cannot (easily) write a function that is calculated in a loop per frame.
in VL however FOR, IF and other language constructs are first class members and you can use and combine them as in your code example.
October 14, 2016, 7:47pm
Thanks both of you for the replies!
VL seems to be more convenient for this task. I will install VL and give it a try.
But for the record: it should be anyhow possible in v4 right?
October 14, 2016, 9:38pm
it is certainly possible to visualize a sorting algorithm for educational purposes in vvvv, but because of the high level nature of vvvv, it is rather a tool that uses algorithms than one that is used to implement them.