Document Sample

(IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 4, July 2010 Multiple Values Bidirectional Square Root Search Syed Zaki Hassan Kazmi Syeda Shehla Kazmi Department of Computer Science Department of Computing & Mathematics IQRA University Islamabad Campus, Manchester Metropolitan University, United Kingdom Pakistan shehla_kazmi@hotmail.com zaki.mzd@gmail.com Syeda Sobia Hassan Kazmi Jamil Ahmad Department of Computer Science Department of Computer Science University Of Azad Jammu And Kashmir IQRA University Islamabad Campus, Muzaffarabad A.K, Pakistan Pakistan fajar_zara@hotmail.com jamil@iqraisb.edu.pk Abstract—The research in hand is an effort to introduce a new its efficiency. Searching is of considerable importance as the efficient searching technique known as Multiple Values human is possessed in searching the Bidirectional Square Root Search. In this technique, a sorted information/knowledge. To search the information list of values can be searched from another sorted list very efficiently the efficient searching technique is very efficiently. The overall time for sorting the values to be searched and searching is less than the time taken by the important. To facilitate the human, computers consume a Linear Search and Binary Search. In this technique, the size of substantial time in searching the data. targeting list is reduced for every next value to be searched. As This paper is organized as follows; Section II presents a a result the searching time of remaining values to be searched brief review of existing searching algorithms. Section III is reduced, while in linear search and binary search the size of presents the description of proposed solution. Section IV target list remains same for every value to be searched. In presents the proposed algorithm. Section V presents other words, we can say that the targeting list is traversed Running Cost Analysis. Section VI present comparison completely each time for every value to be searched from between multiple values bidirectional square root search beginning to end. Running Cost analysis and the result with linear search and binary search. Section VII ends with obtained after implementation are provided in the graphical form with an objective to compare the efficiency of the concluding remarks. technique with linear search as well as binary search, as binary II. A BRIEF REVIEW OF EXISTING SEARCHING search is consider as an efficient and fast one. ALGORITHMS Keywords-Searching; Linear Search; Binary Search. A number of searching techniques are currently used in the field of computer science. This section will briefly I. INTRODUCTION discuss some of the trendy searching techniques among them. These are following: Algorithms have a vital and key role in solving the computational problems, informally an algorithm is a well A. Linear Search defined computational procedure that takes input and It is the simplest method to find the particular element in produces output. Algorithm is a tool or a sequence of steps the list. It checks all of the elements in the list and to solve the computational problems [1]. particularly checks in sequence and one at a time to reach the In computer science, a searching algorithm, broadly particular value. It is the special case of Brute Force Search. speaking, is an algorithm that finds a particular data from a Its worst case cost is proportional to the number of elements data set. Searching takes a problem as input and returns a in the list. It is O (n) [9]. solution to the problem, usually after evaluating a number of B. Binary Search possible solutions. Efficient searching is important to optimizing the use of other algorithms (such as sorting “In computer science, a binary search is an algorithm algorithms) that require searching the location of new item for locating the position of an element in a sorted list. It in sorted list such as in insertion sort. There are a lot of inspects the middle element of the sorted list: if equal to the searching techniques, currently used in industry and sought value, then the position has been found; otherwise, academia, to find the data of various forms and from the upper half or lower half is chosen for further searching different areas. based on whether the sought value is greater than or less The study in hand proposes a new searching technique than the middle element. The method reduces the number of that is tested and analyzed against binary search to provide elements needed to be checked by a factor of two each time, 157 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 4, July 2010 and finds the sought value if it exists in the list or if not IV. ALGORITHM : PSEUDO CODE determines "not present", in logarithmic time. A binary "arr" list of data element and "Data" is the list of value search is a dichotomic divide and conquer search algorithm. to be search. Its running time complexity is O(logn)”[5]. III. MULTIPLE VALUES BIDIRECTIONAL SQUARE ROOT Multi Values Bidirectional Square Root Search SEARCH (arr,Data) Sqr:=square root of "len" In this technique, a sorted list of values can be searched Len:=length[arr]-1 from another sorted list very efficiently. The overall time for i:=0 sorting the values to be searched and searching is less than l:=len the time taken by the Linear Search and Binary Search. In f:=0 this technique, the size of targeting list is reduced for every for f = 0; f <length[Data]; f++ next value to be searched. As a result the searching time of { remaining values to be searched is reduced, while in linear item = data[f]; search and binary search the size of target list remains same j = len; for every value to be searched. In other words, we can say temp = i; that the targeting list is traversed completely each time for sqr = square root of "l" every value to be searched from beginning to end. The steps while arr[i] != item && arr[j] != item && sqr != 1 of the proposed Multiple Values Bidirectional Square Root { Search algorithm are as follows: if arr[i] < item && arr[j] > item { 1. Take 1st element from the item list and assign it to i = i + sqr "item" j = j - sqr 2. Assign 1st element of the Data list to left pointer and } last element of the Data list to right pointer. else 3. Take square root of list length and assign to "sqr". { 4. If value on the left pointer is less then item if arr[i]>item ,increment left pointer .The new location of left { pointer is getting by adding left pointer current j=i-1 location with "sqr". i = i - sqr + 1 5. If value on the left pointer is greater then item, sqr = square root of "sqr" change the location of right pointer by calculating } new location as subtracting 1 from current location of else left pointer. Also change the location of left pointer { by subtracting left pointer current location with "sqr" i=j+1 and increment by 1. The new value of "sqr" is j = j + sqr - 1 calculated by taking square root of "sqr". sqr = square root of "sqr" 6. Similarly If value on the right pointer is greater then } item, decrement right pointer .the new location of right pointer is getting by subtracting right pointer } current location with "sqr". } 7. If value on the right pointer is less then item, change if arr[i] == item the location of left pointer by calculating new { location as adding 1 with current location of right Found Item at "i" pointer. Also change the location of right pointer by while arr[i] == item && i!=temp adding right pointer current location with "sqr" and { decrement by 1. The new value of "sqr" is calculated i=i-1 by taking square root of "sqr". } 8. Repeat step 3 to 6 until value of left pointer or right if i==temp pointer match with item, or the value of "sqr" become { 1. i=i+1 If the value of right pointer match with the item then } assign right pointer to left pointer. Assign data list length to else right pointer and next element in item list to item, go to step i=i+2 3.Repeat this process till all the element in the item list will } be processed. else 158 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 4, July 2010 { Inner Loop Runs: n1/2 + n1/4+ n1/8………………+ n1/k if arr[j] == item Where n1/k ≥1 { Comparison Statements: c Found Item at "j" So the running time of Multiple Values bidirectional while arr[j]==item square root search can be written as, { T (n) = r*(n1/2 (c+c+c)+ n1/4 (c+c+c) + n1/8(c+c+c)+ ……+ j=j-1 n1/k (c+c+c) ) } T (n) = r*(n1/2 (3c)+ n1/4 (3c) + n1/8(3c)+ ………………+ i=j+2 n1/k (3c) ) Ignoring Constants and smaller values we can write it as } T (n) =O (r√n) else { VI. COMPARISON OF MULTIPLE VALUES BIDIRECTIONAL if arr[i+1] == item SQUARE ROOT SEARCH WITH LINEAR SEARCH AND BINARY { SEARCH Found Item at "i+1" Table 1 shows the comparison of the proposed i=i+2 algorithm (Multiple Values Bidirectional Square Root } Search) with the traditional searching algorithms on the else basis of no. of iterations. Graphical view of the same Not Found analysis is presented in the Figure 1. } } l = len – i } V. RUNNING COST ANALYSIS A. Best Case: The main structure of the algorithm depicts that there is an outer main loop within which there lies another inner loop , after number of inner while loop iterations, we will have found our item or concluded that it was not found. Multiple Values Bidirectional Square Root Search Best Case Occur when items are 1st or last element of the Data List. Let T (n) be the running time of Multiple Values Bidirectional Square Root Search on an input list of size n. then running time of Multiple Values Bidirectional Square Root Search Can be calculated as Length of input array: n Length of items array: r Outer Loop runs: r Inner Loop Runs: 1 so the running time of Multiple Values bidirectional square root search can be written as, T (n) = O (r * 1) B. Average and Worst Case: The main structure of the algorithm depicts that there is an outer main loop within which there lies another inner loop , after number of inner while loop iterations, we will have found our item or concluded that it was not found. Let T(n) be the running time of Multiple Values Bidirectional Square Root Search on an input list of size n. then running time of Multiple Values Bidirectional Square Root Search Table 1: Multiple Values Bidirectional Square Root Search Vs Binary Can be calculated as Search and Linear Search Length of input array: n Length of items array: r Outer Loop runs: r 159 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 4, July 2010 36 120000 Multiple Values 100000 Bidirectional 31 Square Root No. of Comparisons 80000 Search 26 Multiple Values Bidirectional 60000 Binary Search No. of Iteration 21 Square Root Search 40000 16 Binary Search 20000 11 0 Linear Search Linear Search 6 12 0 88 1 00 56 1 8 00 10 50 89 10 1 Data Values 59 85 91 Data Values FIGURE 2: MULTIPLE VALUES BIDIRECTIONAL SQUARE ROOT SEARCH V/S BINARY SEARCH AND LINEAR SEARCH Figure 1: Multiple Values Bidirectional Square Root Search v/s Binary Search and Linear Search It can be observed from the Table 2 and graph presented in Figure 2 that performance of proposed algorithm It can be observed from the Table 1 and graph (Multiple Values Bidirectional Square Root Search) is far presented in Figure 1 that performance of proposed better than the linear search. Also it shows good result in algorithm (Multiple Values Bidirectional Square Root comparison with Binary Search and show good competition. Search) is far better than the linear search. Also it shows good result in comparison with Binary Search and show Table 3 shows the comparison of the proposed algorithm good competition. (Multiple Values Bidirectional Square Root Search) with the traditional searching algorithms on the basis of execution Table 2 shows the comparison of the proposed time (in ms). Graphical view of the same analysis is algorithm (Multiple Values Bidirectional Square Root presented in the Figure 3. Total values in data list = Search) with the traditional searching algorithms on the 1000000(1…..1000000) basis of No. of comparisons. Graphical view of the same analysis is presented in the Figure 2. Total values in data list No. of Execution Time(millisecond) = 100000(1…..100000) Elements Linear Multiple Binary Values Comparisons Search Values Search Linear Multiple Binary Bidirectional Search Values Search Square Root Bidirectional Search Square Root 50000 19578 15.6 15.6 Search 100000 40950 31.2 46.8 1 1 1 48 200000 80979.6 62.4 93.6 948 948 9 40 300000 122226 78 109.2 10112 10112 32 43 500000 210678 109.2 187 30336 30336 67 38 600000 350107 124 234 50560 50560 67 32 Table 3: Multiple Values Bidirectional Square Root Search Vs Binary 69032 69032 75 38 Search and Linear Search 89888 89888 33 37 97156 97156 10 41 100000 100000 1 35 Table 2: Multiple Values Bidirectional Square Root Search Vs Binary Search and Linear Search 160 http://sites.google.com/site/ijcsis/ ISSN 1947-5500 (IJCSIS) International Journal of Computer Science and Information Security, Vol. 8, No. 4, July 2010 [4] Donald Knuth. The Art of ComputerProgramming, Volume 3: Sorting and Searching, Third Edition. Addison-Wesley, 1997. ISBN 0-201- 400000 89685-0. pp. 106–110 of section 5.2.2: Sorting by Exchanging. Multiple Values [5] Binary_search, (2010), Binary search, 350000 http://en.wikipedia.org/wiki/Binary_search, Accessed January 01, 2010 Bidirectional [6] Donald Knuth. The Art of Computer Programming, Volume 3: Sorting 300000 Square Root and Searching, Third Edition. Addison-Wesley, 1997. ISBN 0-201- Search 89685-0., pp. 138–141, of Section 5.2.3: Sorting by Selection. 250000 Binary Search [7] Seymour Lipschutz. Theory and Problems of Data Structures,Schaum’s Execution Time(ms) Outline Series: International Edition, McGraw- Hill, 1986. ISBN 0-07- 200000 099130-8., pp. 324–325, of Section 9.4: Selection Sort. [8] Seymour Lipschutz. Theory and Problems of Data Structures,Schaum’s 150000 Outline Series: International Edition, McGraw- Hill, 1986. ISBN 0-07- Linear Search 099130-8., pp. 322–323, of Section 9.3: Insertion Sort. 100000 [9] Linear_search, (2010), Linear search, http://en.wikipedia.org/wiki/Linear_search, Accessed January 50000 01,2010. 0 00 0 0 00 00 0 50 0 0 20 50 No. of Elements Figure 3: Multiple Values Bidirectional Square Root Search v/s Binary Search and Linear Search It can be observed from the Table 3 and graph presented in Figure 3 that performance of proposed algorithm (Multiple Values Bidirectional Square Root Search) is far better than the linear search. Also it shows good result in comparison with Binary Search and show good competition. VII. CONCLUSION By analyzing the graphs above, it can be easily examined that Multiple Values Bidirectional square root search efficient then linear search and also give good competition to binary search. The common thing between Multiple Values Bidirectional Square Root Search and Binary Search is that for both, the list of element should be sorted. In future, we are foreseeing to come up with a new searching technique, which hopefully will be more efficient. ACKNOWLEDGMENT We acknowledge the support and contribution from our loving and caring families, teachers and friends in continuing the education and research. With their moral and financial support, we are in higher education, which encourages us to write this research for the ease of human kind. Thank you all. REFERENCES [1] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Introduction to Algorithms, Second Edition. MIT Press and McGraw-Hill, 2001. ISBN 0-262-03293-7. Section 1.1: Algorithms, pp.5–6. [2] D. A. Bailey, Java Structure:Data Structure in Java for Principled Programmer, 2nd ed. McGraw-Hill, 2003. [3] R. Sedgewick, Algorithms in C++. Reading, Massachusetts: Addison- Wesley, 1992. 161 http://sites.google.com/site/ijcsis/ ISSN 1947-5500

DOCUMENT INFO

Shared By:

Categories:

Tags:
IJCSIS, call for paper, journal computer science, research, google scholar, IEEE, Scirus, download, ArXiV, library, information security, internet, peer review, scribd, docstoc, cornell university, archive, Journal of Computing, DOAJ, Open Access

Stats:

views: | 91 |

posted: | 8/13/2010 |

language: | English |

pages: | 5 |

Description:
The International Journal of Computer Science and Information Security is a monthly periodical on research articles in general computer science and information security which provides a distinctive technical perspective on novel technical research work, whether theoretical, applicable, or related to implementation.
Target Audience: IT academics, university IT faculties; and business people concerned with computer science and security; industry IT departments; government departments; the financial industry; the mobile industry and the computing industry.
Coverage includes: security infrastructures, network security: Internet security, content protection, cryptography, steganography and formal methods in information security; multimedia systems, software, information systems, intelligent systems, web services, data mining, wireless communication, networking and technologies, innovation technology and management.
Thanks for your contributions in July 2010 issue and we are grateful to the reviewers for providing valuable comments. IJCSIS July 2010 Issue (Vol. 8, No. 4) has an acceptance rate of 36 %.

OTHER DOCS BY ijcsiseditor

How are you planning on using Docstoc?
BUSINESS
PERSONAL

By registering with docstoc.com you agree to our
privacy policy and
terms of service, and to receive content and offer notifications.

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.