manu_del In Probability Search , the list is ordered with most probable search element at the beginning of the list and least probable at the end.
Useful when a relatively small number of elements are the targets for most of the searches. To ensure that the probability ordering is correct over time, in each search we exchange the located element with the element immediately before it in the list.
This is a sample ProbabilitySearch program for a list of integers
INPUT:
list[] : reference of integer array
last : index of last item
target: target to be found
ref_locn: reference to the location of target
OUT:
If target is found
location of target is stored in ref_locn
found = 1 is returned
target is moved up in priority
Else
last is stored in ref_locn
found = 0 is returned
int ProbabilitySearch (int list[],int last, int target, int *ref_locn)
{
int looker = 1;
int found = 0;
int temp;
while(looker <= last && target != list[looker])
{
looker = looker + 1;
}
if(target == list[looker])
{
found = 1;
if(looker > 1)
{
temp = list[looker -1];
list[looker -1] = list[looker];
list[looker] = temp;
looker = looker -1;
}
}
else
found = 0;
*ref_locn = looker;
return found;
}
data structure is a way of storing data in a computer so that it can be used efficientlyan algorithm is a sequence of instructions, often used for calculation and data processing.Often a carefully chosen data structure will allow the most efficient algorithm to be used.
Binary Search is the high speed data searching.Here in each recursion the is divided in two equal halves so that execution becomes easier.
By using Depth First Search or Breadth First search Tree traversal algorithm we can print data in Binary search tree.
difference between serch data structure and allocation data structure
please read data structure (schaum series) books
data structure is a way of storing data in a computer so that it can be used efficientlyan algorithm is a sequence of instructions, often used for calculation and data processing.Often a carefully chosen data structure will allow the most efficient algorithm to be used.
Binary Search is the high speed data searching.Here in each recursion the is divided in two equal halves so that execution becomes easier.
difference between serch data structure and allocation data structure
By using Depth First Search or Breadth First search Tree traversal algorithm we can print data in Binary search tree.
please read data structure (schaum series) books
The best case for a binary search is finding the target item on the first look into the data structure, so O(1). The worst case for a binary search is searching for an item which is not in the data. In this case, each time the algorithm did not find the target, it would eliminate half the list to search through, so O(log n).
There are two types of searching technique used in data structure.such as linear and binary search.
It depends on how the data is arranged. In case it is an array, use linear search or binary search or interpolation search according as the array is sorted or not and based on the distribution of data. If some other data structures are used (like heap) for making data retrieval efficient, other algorithms exist.
The complexity of an algorithm is the function which gives the running time and/or space in terms of the input size.
The process of moving all marked nodes to one end of memory and all available memory to other end is called compaction. Algorithm which performs compaction is called compacting algorithm.
Data structure is related to the algorithm, ie solution of the requirements.whereas Data Type is component of a programming language, which can be used to implement the required data structure (organization of data and format).For example if the requirement say that a LIST is required, and in C programming language , there is not LIST data type BUT LIST CAN BE REALISED(IMPLEMENTED ) in C.
* search array => O(1) linked list=> O(n) binary tree=> O(log n) hash=>O(1) * search array => O(1) linked list=> O(n) binary tree=> O(log n) hash=>O(1)