answersLogoWhite

0

An array in C is structured so that it has no particular size; you have to know ahead of time what the dimensions are.

So, a linear search means that you go from the first element to the last, either finding the element in the table, or going to the very last element and not finding it.

Arrays in C can be zero-terminated, in which case you get the element that does not have a value, and that indicates the value you are searching for is not there.

If the array is not zero terminated then you can calculate the dimension of the array, or apply the sizeof operator times the size of the first element to determine the length of the search.

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

Full defecation of array?

Full representation of an array begins from the index 0 and ends at n-1 where n is the number of variables of the array.


Full form of lm as in ic lm-324?

Linear mode


What is the running time of heapsort on an array A of length n that is already sorted in increasing order?

The running time of HEAPSORT on an array A of length n that is already sorted in increasing order is (n lg n) because even though it is already sorted, it will be transformed back into a heap andsorted.The running time of HEAPSORT on an array A of length n that is sorted in decreasing order willbe (n lg n). This occurs because even though the heap will be built in linear time, every time themax element is removed and the HEAPIFY is called it will cover the full height of the tree


What is the limitation of linear queue and how do you overcome using circular queue?

in linear queue when any element is pop out than we do size-1 value changing ie like in the pile of coin when we take out the last coin then all changes there places so likewise we have to change the position of each element..... we can overcome by circular one as we have to change the value of the first and last not the values changes in the array.... but circular queue also had limitation that either u have to use it as size-1 queue or it will show you full even though it is empty fully....as first==last...


How do you compare items in a linked list?

You compare items in a linked list by searching for them. Iterate through the list, comparing elements with the search key. If you encounter end-of-list, then the key is not found, otherwise you have found the element desired. Note that this is a half linear search. Statistically, if an element is to be found, it will be found at the halfway point, assuming uniformly random distribution of data. In the worst case, if the element is not found, it will always take a full search to prove that. You could keep the linked list in order, by inserting each element before the element that has higher key value. This would reduce search time to half, because searching would stop with the element with higher key value. Searching is not a very efficient use of a linked-list. It would be better to use some kind of ordered list, perhaps a dynamic array with binary search, or a balanced binary tree, which has similar search performance but one with the most cost to design and implement. Linked-lists are better for keeping elements in the order they were encountered or inserted, such as processing tokens in a compiler. Sorry, but every solution has its tradeoffs.