Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

linkedlist method in js

/* amethod to find the maximum node value in the linkedlist*/ 
maxNode(list) {
            let current = list.head;
            let max = 0;
            while (current) {
                if (current.value > max) {
                    max = current.value
                }
                current = current.next;
            }
            return max;
        }
Source by ulvimmeedov.herokuapp.com #
 
PREVIOUS NEXT
Tagged: #linkedlist #method #js
ADD COMMENT
Topic
Name
6+7 =