Shuffle a GList ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

How can I randomly shuffle the elements in a linked list? There is no
implemented method for this, is it?

The first thing I think of is: for each element, pick another an other
element and swap these two. But since I do not have random access to the
elements in the linked list this becomes a O(n2) algorithm, doesn't it?

-Øystein

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux