Difference between revisions of "LL Nth"

Line 1: Line 1:
== LL_Nth( LL, n ) ==
+
== LL_Nth(LL, n) ==
  
 
Returns the «n»th item in the linked list «LL», or returns [[Null]] when «LL» has fewer than «n» items.
 
Returns the «n»th item in the linked list «LL», or returns [[Null]] when «LL» has fewer than «n» items.

Revision as of 02:10, 29 January 2016

LL_Nth(LL, n)

Returns the «n»th item in the linked list «LL», or returns Null when «LL» has fewer than «n» items.

This is a slow operation, which requires «n» steps to completes, since it must walk the linked list. Once you have finished collecting items, it is better to convert the linked list to an array using LL_To_RArray or LL_To_Array before using the collection. Once you've converted to an array, then random access into the array can be done in constant time using Slice or Subscript.

To use this function, you must add the Linked list library to your model.

See Also

Comments


You are not allowed to post comments.