answersLogoWhite

0

To find the highest and lowest elements in a linked list, iterate the list and detect the highest and lowest elements. Details omitted ...

list *head; /* pointer to first element */

list *temp; /* temp pointer

list *high = null; /* pointer to high element */

list *low = null; /* pointer to low element */

for (temp=head; temp!=null; temp=temp->next) { /* iterate all elements */

if (temp == head ) { /* initial case */

high = low = temp; /* start accumulating results

} else { /* otherwise */

if (higher(temp, high) high = temp; /* choose higher */

if (lower(temp, low) low = temp; /* choose lower */

}

}

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

How do you get the range in a frequency chart?

To find the range in a frequency chart, first identify the highest and lowest values in the data set. Subtract the lowest value from the highest value: Range = Highest Value - Lowest Value. This calculation gives you the spread of values represented in the frequency chart.


Algorithm for finding min element in a linked list?

In a linked list, there is no way to find the "min element" or any other element with a specific property except by walking through the entire list. Of course, you could store a pointer to the min element and update that each time the list changes (add ing or deleting an element), which makes the list less generic and a tiny bit slower but is worth it if you need this min element often.Pseudocode for finding the min element (I'm assuming you're storing values and you want the element with the lowest value):ptr_minelement = null;ptr_element = ptr_firstelement;while (ptr_element != null) {if (ptr_minelement == null) or (ptr_minelement->value > ptr_element->value)ptr_minelement = ptr_element;ptr_element = ptr_element->ptr_next;}


Explain the linked list and multi linked list structures?

I tried my best to explain all Linked List. For Single Linked List http://www.fansonnote.com/2012/02/single-linked-list/ For Double Linked List http://www.fansonnote.com/2012/02/double-linked-list/ For Multi Linked List http://www.fansonnote.com/2012/02/multi-linked-list/ Hope it will help. Thanks.


Draw a flowchart showing the general logic for finding the highest value in the arrary?

To find the highest value in an array, start with the first element as the initial maximum. Iterate through each element in the array, comparing it to the current maximum. If an element is greater than the current maximum, update the maximum to this element. After checking all elements, the current maximum will be the highest value in the array.


How do you find the HCF of all the numbers in an array java?

I guess you mean the highest common factor. Use a loop. Start assuming that the hcf is the first number in the array. Call this "result". Find the hcf of "result" and the second element, assign this to "result". Find the hcf of "result" and the third element, and copy this back to result, etc.

Related Questions

What is the time complexity to find an element in a linked list?

The time complexity to find an element in a linked list is O(n), where n is the number of elements in the list. This means that the time it takes to find an element in a linked list increases linearly with the number of elements in the list.


How do you get the range of integer values?

The range of a set of numbers is the difference between the highest and lowest values. Find these and subtract the lowest from the highest.


How do you find the median when theres four numbers?

When sorted lowest to highest (or highest to lowest) the median is (2nd number + 3rd number)/2


How find out the given five numbers is lowest as well as highest?

Any number can be the lowest as well the highest of a set only if all the numbers are the same.


How do you calculate range in mathformula for range?

Find the rangeset of data:88,76,59,39,20,85,94,20,67step 1: rearrange from lowest to highest20,20,39,59,67,76,85,88,94step 2: highest - lowest = range94 - 20Answer = 74basics:1.rearrange from lowest to highest2.highest - lowest = range


How do you find a temperature range?

The highest temperature minus the lowest temperature is the temperature range. The temperature range is how many degrees is in between the highest and lowest temperatures.


How do you find range in a set of numbers?

The first step is to sort the numbers from highest to lowest. The range is then the difference between the first and last numbers, or the highest and lowest.


Can you find out the highest and lowest note the trumpet play?

The lowest standard note on trumpet is the F-sharp below the staff. The highest note depends on the player.


How do you find the lowest point on a linear graph?

Lines are infinite and so do not have a highest or lowest point. You need to have a curve to have a possible lowest point.


How do you find the element with the largest volume?

Look for the one with the lowest density.


How do you find the range in box and whisker plot?

The highest and lowest numbers in a box and whisker plot are shown by the two dots at the end of the "whiskers". To find the range, you must subtract the highest number from the lowest number.


How do you get the range in a frequency chart?

To find the range in a frequency chart, first identify the highest and lowest values in the data set. Subtract the lowest value from the highest value: Range = Highest Value - Lowest Value. This calculation gives you the spread of values represented in the frequency chart.