Find the smallest value in linked list using:
Iterator
Loop
recursion
Find the smallest value in linked list using..iterator- loop- recursion?
while (i=0 ; i%26lt; length_of_list; i++)
start function find_smallest(a,b,smallest)
smallest = a;
if (b %26lt; a
{
smallest = b;
a=b;
}
b = b-%26gt;next;
find_smallest(a,b,smallest)
} end function;
end while
Reply:This is a simple algorithm.
iterator max_item
integer maxvalue = 0
iterator item = first_item_in_list
while item not null
if item-%26gt;value %26gt; max_value
max_value = item-%26gt;value
max_item = item
item = next_item
loop
No comments:
Post a Comment