View previous topic :: View next topic
|
Author |
Message |
mrlee
New User
Joined: 10 Jun 2005 Posts: 4
|
|
|
|
can we use SET verb in SEARCH ALL like SEARCH. |
|
Back to top |
|
|
Sangita
New User
Joined: 02 Jun 2005 Posts: 17
|
|
|
|
Hi,
Since SEARCH ALL is a binary search while SEARCH is sequential search,
so a SET statement is not necessary with the SEARCH ALL, since
the index is set to the appropriate point initially when each
binary search beings by the computer.
Regards,
Sangita |
|
Back to top |
|
|
mrlee
New User
Joined: 10 Jun 2005 Posts: 4
|
|
|
|
asume that 10000 records in u table with record size of 10.
i want search for 9000 th record.
can set index to 5000? if so how the search will process in search all.
i want to clarify how the search all will do? |
|
Back to top |
|
|
Sangita
New User
Joined: 02 Jun 2005 Posts: 17
|
|
|
|
Hi mrlee,
SEARCH ALL is a binary search. And for that the records should be in
a sorted order either ascending / decending.
The cocept in binary search is the records are divided and search starts from middle ,
taking your example if u want to search the 9000th record then
SEARCH ALL will start from middle i.e 5000th record and will
compare with 9000 as 9000 > 5000 ,there will be sequential search
from the latter half i.e from 5000 to 10000 so we don't give any SET for SEARCH ALL its taken automatically.
Regards,
Sangita |
|
Back to top |
|
|
sudheer648
New User
Joined: 23 May 2005 Posts: 97 Location: Chennai
|
|
|
|
Hi Sangita,
Your answer is partially correct it chops it and it wont continue the sequential search from 5000 to 10000 for 9000th record it still chops it.
Formula for Binary Search middle= (x+y)/2.suppose x is lower end is 0 and higher end 10000
If search element is greater than middle it considers the x=middle and y=y itself it still chops.
if search element is lesser than middle it considers the x=x;y=middle.
if search element is equal to middle it stops the search.
There is no sequential search in Binary Search again for your kind Information.
comments are invited |
|
Back to top |
|
|
Sangita
New User
Joined: 02 Jun 2005 Posts: 17
|
|
|
|
Hi sudheer,
Thanks for correcting me.
Regards,
Sangita |
|
Back to top |
|
|
|