answersLogoWhite

0


Best Answer

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;

}

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Probability search in data structure and algorithm?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What data structure and logarithm?

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.


What is a high speed data searching and sorting in data structure algorithm?

Binary Search is the high speed data searching.Here in each recursion the is divided in two equal halves so that execution becomes easier.


What is the difference between allocation and search data structure?

difference between serch data structure and allocation data structure


How do you print all data in a Binary Search Tree?

By using Depth First Search or Breadth First search Tree traversal algorithm we can print data in Binary search tree.


Write a algorithm for a deque operations?

please read data structure (schaum series) books


What is the worst case and best case for binary search?

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).


How many search techniqe's in data structure?

There are two types of searching technique used in data structure.such as linear and binary search.


What is best algorithm for searching?

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.


Case complexity in data structure algorithms?

The complexity of an algorithm is the function which gives the running time and/or space in terms of the input size.


What is compaction in data structure?

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.


What is the first no for sialkot?

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.


Complexity of an algorithm in data structure?

* search array =&gt; O(1) linked list=&gt; O(n) binary tree=&gt; O(log n) hash=&gt;O(1) * search array =&gt; O(1) linked list=&gt; O(n) binary tree=&gt; O(log n) hash=&gt;O(1)