#include-once ; #INDEX# ======================================================================================================================= ; Title .........: LinkedList ; AutoIt Version : 3.3 ; AutoItObject Version : v1.2.8.2 ; Language ......: English ; Description ...: This script/library provides a linked list implementation in AutoIt. ; Dependencies ..: AutoItObject.au3 ; Author ........: Numeric ; =============================================================================================================================== #include "AutoItObject.au3" ; Add this line To indicate the dependency on AutoItObject.au3 ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; Func _clear($self) ; Func _contains($self, $data) ; Func _copy($self) ; Func _deleteData($self, $data) ; Func _deduplicate($self) ; Func _getAtIndex($self, $index) ; Func _getFirstNode($self) ; Func _getLastNode($self) ; Func _insertAfterNode($self, $data, $nodeData) ; Func _insertAtIndex($self, $data, $index) ; Func _insertAtBegin($self, $data) ; Func _insertAtEnd($self, $data) ; Func _isEmpty($self) ; Func _merge($self, $otherList) ; Func _printLL($self) ; Func _remove_at_index($self, $index) ; Func _remove_first_node($self) ; Func _remove_last_node($self) ; Func _remove_node($self, $data) ; Func _reverse($self) ; Func _search($self, $data) ; Func _sizeOfLL($self) ; Func _sort($self) ; Func _split($self, $index) ; Func _updateNode($self, $val, $index) ; =============================================================================================================================== #Region ; Initialisation _AutoItObject_Startup() OnAutoItExitRegister('_freeObject') Func _freeObject() _AutoItObject_Shutdown() EndFunc ;==>_freeObject #EndRegion ; #FUNCTION# ==================================================================================================================== ; Name .........: LinkedList ; Description ...: This function creates and returns a linked list data structure in AutoIt. ; Syntax .......: LinkedList() ; Parameters ....: None ; Return Value .: Returns a handle to the linked list. ; Author .......: Numeric ; Modified ...... : ; Remarks .......: The linked list can be used to store and manage a dynamic sequence of data. ; Related ....... : ; Example ....... : Yes, see the example below. ; =============================================================================================================================== Func LinkedList() Local $cLinkedList = _AutoItObject_Class() With $cLinkedList ;LinkedList property .AddProperty("head", $ELSCOPE_PUBLIC, Null) ;LinkedList Methodes .AddMethod("clear", "_clear") .AddMethod("contains", "_contains") .AddMethod("copy", "_copy") .AddMethod("deleteData", "_deleteData") .AddMethod("deduplicate", "_deduplicate") .AddMethod("getAtIndex", "_getAtIndex") .AddMethod("getFirstNode", "_getFirstNode") .AddMethod("getLastNode", "_getLastNode") .AddMethod("insertAfterNode", "_insertAfterNode") .AddMethod("insertAtBegin", "_insertAtBegin") .AddMethod("insertAtIndex", "_insertAtIndex") .AddMethod("insertAtEnd", "_insertAtEnd") .AddMethod("isEmpty", "_isEmpty") .AddMethod("iterator", "LinkedListIterator") .AddMethod("merge", "_merge") .AddMethod("printLL", "_printLL") .AddMethod("remove_at_index", "_remove_at_index") .AddMethod("remove_first_node", "_remove_first_node") .AddMethod("remove_last_node", "_remove_last_node") .AddMethod("remove_node", "_remove_node") .AddMethod("reverse", "_reverse") .AddMethod("search", "_search") .AddMethod("sizeOfLL", "_sizeOfLL") .AddMethod("sort", "_sort") .AddMethod("split", "_split") .AddMethod("updateNode", "_updateNode") EndWith Return $cLinkedList.Object EndFunc ;==>LinkedList #Region dependance interne ; #FUNCTION# ==================================================================================================================== ; Author ........: Numeric ; Modified.......: ; =============================================================================================================================== Func Node($data) Local $cNodeClass = _AutoItObject_Class() With $cNodeClass .AddProperty("data", $ELSCOPE_PUBLIC, $data) .AddProperty("next", $ELSCOPE_PUBLIC, Null) EndWith Return $cNodeClass.Object EndFunc ;==>Node ; #FUNCTION# ==================================================================================================================== ; Author ........: Numeric ; Modified.......: ; =============================================================================================================================== Func insertSorted($sorted, $new_node) If $sorted == Null Or $new_node.data <= $sorted.data Then $new_node.Next = $sorted Return $new_node EndIf Local $current_node = $sorted While $current_node.Next <> Null And $current_node.Next.data < $new_node.data $current_node = $current_node.Next WEnd $new_node.Next = $current_node.Next $current_node.Next = $new_node Return $sorted EndFunc ;==>insertSorted #EndRegion dependance interne #Region internal iterator ; #FUNCTION# ==================================================================================================================== ; Name ..........: LinkedListIterator ; Description ...: Creates an iterator for traversing a linked list. ; Syntax ........: LinkedListIterator(ByRef $linkedListObject) ; Parameters ....: $linkedListObject - [in/out] Reference to the linked list object. ; Return values .: The iterator object. ; Author ........: Numeric ; Modified ......: ; Remarks .......: Make sure the linked list structure has a "nextNode" property to track the next node. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func LinkedListIterator(ByRef $linkedListObject) Local $c_iterator = _AutoItObject_Class() With $c_iterator .AddProperty("currentNode", $ELSCOPE_PUBLIC, $linkedListObject.head) .AddMethod("isDone", "_isDone") .AddMethod("next", "_next") EndWith Return $c_iterator.Object EndFunc ;==>LinkedListIterator ; Méthode pour vérifier si l'itération est terminée Func _isDone($self) Return $self.currentNode == Null EndFunc ;==>_isDone ; Méthode pour obtenir l'élément suivant Func _next($self) If Not $self.isDone() Then Local $data = $self.currentNode.data $self.currentNode = $self.currentNode.Next Return $data EndIf Return Null EndFunc ;==>_next #EndRegion internal iterator ; #FUNCTION# ==================================================================================================================== ; Name ..........: _clear ; Description ...: Clears all elements from the linked list, leaving the list empty. ; Syntax ........: _clear($self) ; Parameters ....: $self - Linked list instance. ; Return values .: None ; Author ........: Your Name ; Modified ......: ; Remarks .......: This function resets the linked list by removing all of its data. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _clear($self) $self.head = Null EndFunc ;==>_clear ; #FUNCTION# ==================================================================================================================== ; Name ..........: _contains ; Description ...: Checks if the specified data is present in the linked list. ; Syntax ........: _contains($self, $data) ; Parameters ....: $self - Linked list instance. ; $data - Data to check for. ; Return values .: True if the data is present in the linked list, False otherwise. ; Author ........: Numeric ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _contains($self, $data) Local $current_node = $self.head While $current_node <> Null If $current_node.data == $data Then Return True EndIf $current_node = $current_node.Next WEnd Return False EndFunc ;==>_contains ; #FUNCTION# ==================================================================================================================== ; Name ..........: _copy ; Description ...: Creates a copy of the linked list. ; Syntax ........: _copy($self) ; Parameters ....: $self - Linked list instance. ; Return values .: Returns a new linked list that is a copy of the original. ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function creates a duplicate of the linked list, preserving its contents. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _copy($self) Local $newList = LinkedList() Local $current_node = $self.head While $current_node <> Null $newList.insertAtEnd($current_node.data) $current_node = $current_node.Next WEnd Return $newList EndFunc ;==>_copy ; #FUNCTION# ==================================================================================================================== ; Name ..........: _deleteData ; Description ...: Deletes all occurrences of a specified data from the linked list. ; Syntax ........: _deleteData($self, $data) ; Parameters ....: $self - Linked list instance. ; $data - Data to be deleted from the linked list. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function removes all instances of the specified data from the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _deleteData($self, $data) Local $current_node = $self.head Local $prev_node = Null While $current_node <> Null If $current_node.data == $data Then If $prev_node == Null Then $self.head = $current_node.Next Else $prev_node.Next = $current_node.Next EndIf EndIf $prev_node = $current_node $current_node = $current_node.Next WEnd EndFunc ;==>_deleteData ; #FUNCTION# ==================================================================================================================== ; Name ..........: _deduplicate ; Description ...: Removes duplicate elements from the linked list. ; Syntax ........: _deduplicate($self) ; Parameters ....: $self - Linked list instance. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function removes duplicate elements from the linked list, keeping only the first occurrence. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _deduplicate($self) Local $current_node = $self.head While $current_node <> Null Local $data = $current_node.data Local $runner = $current_node While $runner.Next <> Null If $runner.Next.data == $data Then $runner.Next = $runner.Next.Next Else $runner = $runner.Next EndIf WEnd $current_node = $current_node.Next WEnd EndFunc ;==>_deduplicate ; #FUNCTION# ==================================================================================================================== ; Name ..........: _getAtIndex ; Description ...: Retrieves the data at the specified index in the linked list. ; Syntax ........: _getAtIndex($self, $index) ; Parameters ....: $self - Linked list instance. ; $index - An integer value representing the index. ; Return values .: Returns the data at the specified index or Null if the index is not found. ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function retrieves the data stored at the specified index in the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _getAtIndex($self, $index) Local $current_node = $self.head Local $position = 0 While $current_node <> Null If $position == $index Then Return $current_node.data EndIf $position = $position + 1 $current_node = $current_node.Next WEnd ;ConsoleWrite("Index not found" & @CRLF) Return Null EndFunc ;==>_getAtIndex ; #FUNCTION# ==================================================================================================================== ; Name ..........: _getFirstNode ; Description ...: Retrieves the data of the first node in the linked list. ; Syntax ........: _getFirstNode($self) ; Parameters ....: $self - Linked list instance. ; Return values .: Returns the data of the first node or displays an error message if the list is empty. ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function retrieves the data stored in the first node of the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _getFirstNode($self) If $self.head <> Null Then Return $self.head.data Else ;ConsoleWrite("List is empty" & @CRLF) Return EndIf EndFunc ;==>_getFirstNode ; #FUNCTION# ==================================================================================================================== ; Name ..........: _getLastNode ; Description ...: Retrieves the data of the last node in the linked list. ; Syntax ........: _getLastNode($self) ; Parameters ....: $self - Linked list instance. ; Return values .: Returns the data of the last node or displays an error message if the list is empty. ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function retrieves the data stored in the last node of the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _getLastNode($self) Local $current_node = $self.head If $current_node <> Null Then While $current_node.Next <> Null $current_node = $current_node.Next WEnd Return $current_node.data Else ;ConsoleWrite("List is empty" & @CRLF) Return EndIf EndFunc ;==>_getLastNode ; #FUNCTION# ==================================================================================================================== ; Name ..........: _insertAfterNode ; Description ...: Inserts a new node with data after the specified node with the given data. ; Syntax ........: _insertAfterNode($self, $data, $nodeData) ; Parameters ....: $self - Linked list instance. ; $data - Data to be inserted. ; $nodeData - Data of the node after which the new node is to be inserted. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function inserts a new node with the provided data after the first node with data matching $nodeData. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _insertAfterNode($self, $data, $nodeData) Local $new_node = Node($data) Local $current_node = $self.head While $current_node <> Null If $current_node.data == $nodeData Then $new_node.Next = $current_node.Next $current_node.Next = $new_node Return EndIf $current_node = $current_node.Next WEnd ;ConsoleWrite("Node not found" & @CRLF) EndFunc ;==>_insertAfterNode ; #FUNCTION# ==================================================================================================================== ; Name ..........: _insertAtBegin ; Description ...: Inserts a new node with data at the beginning of the linked list. ; Syntax ........: _insertAtBegin($self, $data) ; Parameters ....: $self - Linked list instance. ; $data - Data to be inserted at the beginning of the linked list. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function inserts a new node with the provided data at the beginning of the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _insertAtBegin($self, $data) Local $new_node = Node($data) If $self.head == Null Then $self.head = $new_node Return 1 Else $new_node.Next = $self.head $self.head = $new_node EndIf EndFunc ;==>_insertAtBegin ; #FUNCTION# ==================================================================================================================== ; Name ..........: _insertAtIndex ; Description ...: Inserts a new node with data at the specified index in the linked list. ; Syntax ........: _insertAtIndex($self, $data, $index) ; Parameters ....: $self - Linked list instance. ; $data - Data to be inserted in the linked list. ; $index - Index at which the data should be inserted. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function inserts a new node with the provided data at the specified index in the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _insertAtIndex($self, $data, $index) Local $new_node = Node($data) Local $current_node = $self.head Local $position = 0 If $position == $index Then $self.insertAtBegin($data) Else While ($current_node <> Null And $position + 1 <> $index) $position = $position + 1 $current_node = $current_node.Next WEnd If $current_node <> Null Then $new_node.Next = $current_node.Next $current_node.Next = $new_node Else Return ;ConsoleWrite("Index not present" & @CRLF) EndIf EndIf EndFunc ;==>_insertAtIndex ; #FUNCTION# ==================================================================================================================== ; Name ..........: _insertAtEnd ; Description ...: Inserts a new node with data at the end of the linked list. ; Syntax ........: _insertAtEnd($self, $data) ; Parameters ....: $self - Linked list instance. ; $data - Data to be inserted at the end of the linked list. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function inserts a new node with the provided data at the end of the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _insertAtEnd($self, $data) Local $new_node = Node($data) If $self.head == Null Then $self.head = $new_node Return 1 EndIf Local $current_node = $self.head While ($current_node.Next <> Null) $current_node = $current_node.Next WEnd $current_node.Next = $new_node EndFunc ;==>_insertAtEnd ; #FUNCTION# ==================================================================================================================== ; Name ..........: _isEmpty ; Description ...: Checks if the linked list is empty. ; Syntax ........: _isEmpty($self) ; Parameters ....: $self - Linked list instance to be checked for emptiness. ; Return values .: True if the linked list is empty, False otherwise. ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function checks whether the linked list is empty. It returns True if the linked list has no nodes (i.e., the head is Null), and False if there are nodes in the list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _isEmpty($self) Return $self.head == Null EndFunc ;==>_isEmpty ; #FUNCTION# ==================================================================================================================== ; Name ..........: _merge ; Description ...: Merges the current linked list with another linked list. ; Syntax ........: _merge($self, $otherList) ; Parameters ....: $self - Current linked list instance. ; $otherList - Linked list to be merged with the current linked list. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function merges the current linked list with another linked list provided as $otherList. ; The contents of the $otherList are merged into the current list, and the $otherList is cleared. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _merge($self, $otherList) If $self.head == Null Then $self.head = $otherList.head ElseIf $otherList.head <> Null Then Local $current_node = $self.head While $current_node.Next <> Null $current_node = $current_node.Next WEnd $current_node.Next = $otherList.head EndIf $otherList.head = Null EndFunc ;==>_merge ; #FUNCTION# ==================================================================================================================== ; Name ..........: _printLL ; Description ...: Prints the contents of a linked list. ; Syntax ........: _printLL($self) ; Parameters ....: $self - Linked list instance. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function prints the elements of the linked list to the console or output. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _printLL($self) Local $current_node = $self.head While $current_node <> Null ConsoleWrite($current_node.data & @CRLF) $current_node = $current_node.Next WEnd EndFunc ;==>_printLL ; #FUNCTION# ==================================================================================================================== ; Name ..........: _remove_at_index ; Description ...: Removes an element from the linked list at the specified index. ; Syntax ........: _remove_at_index($self, $index) ; Parameters ....: $self - A linked list instance. ; $index - An integer specifying the index of the element to remove. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function removes the element at the specified index in the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _remove_at_index($self, $index) If $self.head == Null Then Return 1 EndIf Local $current_node = $self.head Local $position = 0 If $position == $index Then $self.remove_first_node() Else While ($current_node <> Null And $position + 1 <> $index) $position = $position + 1 $current_node = $current_node.Next WEnd If $current_node <> Null Then $current_node.Next = $current_node.Next.Next Else ;ConsoleWrite("Index not present" & @CRLF) Return EndIf EndIf EndFunc ;==>_remove_at_index ; #FUNCTION# ==================================================================================================================== ; Name ..........: _remove_first_node ; Description ...: Removes the first node from the linked list. ; Syntax ........: _remove_first_node($self) ; Parameters ....: $self - A linked list instance. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function removes the first node from the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _remove_first_node($self) If $self.head == Null Then Return 1 EndIf $self.head = $self.head.Next EndFunc ;==>_remove_first_node ; #FUNCTION# ==================================================================================================================== ; Name ..........: _remove_last_node ; Description ...: Removes the last node from the linked list. ; Syntax ........: _remove_last_node($self) ; Parameters ....: $self - A linked list instance. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function removes the last node from the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _remove_last_node($self) If $self.head == Null Then Return 1 EndIf Local $current_node = $self.head While ($current_node.Next.Next <> Null) $current_node = $current_node.Next WEnd $current_node.Next = Null EndFunc ;==>_remove_last_node ; #FUNCTION# ==================================================================================================================== ; Name ..........: _remove_node ; Description ...: Removes a node with the specified data from the linked list. ; Syntax ........: _remove_node($self, $data) ; Parameters ....: $self - Linked list instance. ; $data - Data to be removed from the linked list. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function removes a node from the linked list that contains the specified data value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _remove_node($self, $data) Local $current_node = $self.head While ($current_node <> Null And $current_node.Next.data <> $data) $current_node = $current_node.Next WEnd If $current_node == Null Then Return 1 Else $current_node.Next = $current_node.Next.Next EndIf EndFunc ;==>_remove_node ; #FUNCTION# ==================================================================================================================== ; Name ..........: _reverse ; Description ...: Reverses the order of elements in the linked list. ; Syntax ........: _reverse($self) ; Parameters ....: $self - Linked list instance. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function reverses the order of elements in the linked list by reversing the "next" pointers of each node. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _reverse($self) Local $current_node = $self.head Local $prev_node = Null Local $next_node = Null While ($current_node <> Null) $next_node = $current_node.Next $current_node.Next = $prev_node $prev_node = $current_node $current_node = $next_node WEnd $self.head = $prev_node EndFunc ;==>_reverse ; #FUNCTION# ==================================================================================================================== ; Name ..........: _search ; Description ...: Searches for a specific data value in the linked list and returns its index. ; Syntax ........: _search($self, $data) ; Parameters ....: $self - Linked list instance. ; $data - Data value to search for in the linked list. ; Return values .: Returns the index of the first occurrence of the specified data, or -1 if not found. ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function searches for the specified data value in the linked list and returns the index of its first occurrence. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _search($self, $data) Local $current_node = $self.head Local $position = 0 While ($current_node <> Null And $current_node.data == $data) $position = $position + 1 $current_node = $current_node.Next WEnd If $current_node == Null Then ;ConsoleWrite("Data not found" & @CRLF) Return -1 Else Return $position EndIf EndFunc ;==>_search ; #FUNCTION# ==================================================================================================================== ; Name ..........: sizeOfLL ; Description ...: Returns the number of elements in the linked list. ; Syntax ........: sizeOfLL($self) ; Parameters ....: $self - Linked list instance. ; Return values .: Returns the count of elements in the linked list. ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function calculates and returns the total number of elements present in the linked list. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _sizeOfLL($self) Local $size = 0 If ($self.head <> Null) Then Local $current_node = $self.head While ($current_node <> Null) $size = $size + 1 $current_node = $current_node.Next WEnd Return $size Else Return 0 EndIf EndFunc ;==>_sizeOfLL ; #FUNCTION# ==================================================================================================================== ; Name ..........: sort ; Description ...: Sorts the elements of the linked list in ascending order. ; Syntax ........: sort($self) ; Parameters ....: $self - Linked list instance. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function sorts the elements of the linked list in ascending order. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _sort($self) If $self.head == Null Or $self.head.Next == Null Then Return EndIf Local $sorted = Null Local $current_node = $self.head While $current_node <> Null Local $next_node = $current_node.Next $sorted = insertSorted($sorted, $current_node) $current_node = $next_node WEnd $self.head = $sorted EndFunc ;==>_sort ; #FUNCTION# ==================================================================================================================== ; Name ..........: _split ; Description ...: Splits the linked list into two linked lists at the specified index. ; Syntax ........: _split($self, $index) ; Parameters ....: $self - Linked list instance to be split. ; $index - An integer value representing the index at which the split should occur. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function splits the linked list into two separate linked lists at the specified index. The original list remains intact, and a new list is created starting from the specified index. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _split($self, $index) If $self.head == Null Or $index < 0 Then Return EndIf Local $current_node = $self.head Local $count = 0 While $current_node <> Null And $count < $index - 1 $count += 1 $current_node = $current_node.Next WEnd If $current_node <> Null Then Local $newList = LinkedList() $newList.head = $current_node.Next $current_node.Next = Null Return $newList EndIf Return EndFunc ;==>_split ; #FUNCTION# ==================================================================================================================== ; Name ..........: _updateNode ; Description ...: Updates the data of a node at the specified index in the linked list. ; Syntax ........: _updateNode($self, $val, $index) ; Parameters ....: $self - Linked list instance. ; $val - New data value to be assigned to the node. ; $index - An integer value representing the index of the node to update. ; Return values .: None ; Author ........: Numeric ; Modified ......: ; Remarks .......: This function updates the data of the node at the specified index in the linked list with the new data value provided. If the index is not found in the list, no changes are made. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _updateNode($self, $val, $index) Local $current_node = $self.head Local $position = 0 If $position == $index Then $current_node.data = $val Else While ($current_node <> Null And $position <> $index) $position = $position + 1 $current_node = $current_node.Next WEnd If $current_node <> Null Then $current_node.data = $val Else ;ConsoleWrite("Index not present" & @CRLF) Return EndIf EndIf EndFunc ;==>_updateNode