Skip List Data Structure Based New Searching Algorithm and Its Applications : Priority Search

Our new algorithm, priority search, was created with the help of skip list data structure and algorithms. Skip list data structure consists of linked lists formed in layers, which were linked in a pyramidal way. The time complexity of searching algorithm is equal to O(lgN) in an N-element skip list data structure. The new developed searching algorithm was based on the hit search number for each searched data. If a datum has greater hit search number, then it was upgraded in the skip list data structure to the upper level. That is, the mostly searched data were located in the upper levels of the skip list data structure and rarely searched data were located in the lower levels of the skip list data structure. The pyramidal structure of data was constructed by using the hit search numbers, in another word, frequency of each data. Thus, the time complexity of searching was almost Ө(1) for N records data set. In this paper, the applications of searching algorithms like linear search, binary search, and priority search were realized, and the obtained results were compared. The results demonstrated that priority search algorithm was better than the binary search algorithm. Keywords—Algorithms; Priority search; Algorithm analysis; Data structures; Performance analysis


INTRODUCTION
Various disciplines in computer sciences benefit from algorithms and data structures directly or indirectly, and different data structures were used as solutions to various problems.The limitations like processing, time complexity, required hardware or inefficiency of current algorithms conclude in defining new algorithms such as searching, sorting, and graph algorithms [1].
Sometimes, an algorithm was preferred on another one because of its processing, time complexity, etc.For example, binary search was preferred instead of sequential search to increase searching complexity.Skip list data structures based searching algorithm presented in this study is another option instead of binary search.Considering these factors, it is evident that new algorithms and data structures will continue to emerge as needed [2].
In computer science, the linked list is a data structure consisting of a group of nodes, which together represent a sequence (Fig. 1).The principal benefit of a linked list over a conventional array is that in the linked list elements can easily be inserted or removed without reallocation or reorganization of the entire structure, because the data items need not to be stored contiguously in memory or on disk.Linked lists allow insertion and removal of nodes at any point in the list, and can do so with a constant number of operations if the link previous to the link being added or removed was maintained during list traversal.Linked lists by themselves do not allow random access to the data, or any form of efficient indexing.Thus, many basic operations may require scanning most or all of the list elements [3], [20].The time complexity of linked list is linear, so, the time complexity of searching in linked list of size N is O(N) [15], [19].In this study, a new searching algorithm based on the skip list was developed and it was compared to other searching algorithms by doing some applications.The rest of paper was arranged as follows: Related works have been presented in Section II.The skip list data structure must be clarified for the sake of the understandability of developed searching algorithm.Due to this case, Section III explains the skip list data structure.The methodology of proposed algorithm has been explained in Section IV and Section V demonstrates the experimental results and significance of work.The conclusion has been given in Section VI.

II.
RELATED WORKS Skip list data structure, which was introduced by Pugh [8], is a data structure alternative to binary tree search structure.Search, insertion and deletion algorithms of nodes in skip list data structure is discussed in article written by Pugh [8].The time complexity of searching in the skip list data structure is O(lgN).In addition, several studies have been conducted so far on the improvement and analysis of skip list data structure algorithms.In [2], how randomly creation of levels and different -P‖ thresholds (0.25, 0.5, 0.75) effect the performance was studied and solutions were proposed.
An optimized search algorithm for skip lists was analyzed in [6].In [7], the probabilistic analysis of the search cost was considered in a slightly different way, namely, performing the asymptotic analysis of the total search cost or path length.
In [12], proposed exploring techniques based on the notion of a skip list to guarantee logarithmic search, insert and delete www.ijacsa.thesai.orgcosts.The basic idea is to insist on that between any pair of elements above a given height are a small number of elements of precisely that height.
Other studies are about level optimization in skip list data structure [1], formal verification of a lazy concurrent list-based set [4], a simple optimistic skip list algorithm [5], average search and update costs in skip lists [9], skip lists and probabilistic analysis of algorithms [10], the binomial transform and the analysis of skip lists [11], deterministic skip lists [12], a skip lists cookbook [13], and concurrent maintenance of skip lists [14].
Various data structures and algorithms were also created apart from skip list data structure such as Tiara: A selfstabilizing deterministic skip list and skip graph [22],Corona: A Stabilizing Deterministic Message-Passing Skip List [23] and Skip lift: A probabilistic alternative to red-black trees [24].

III.
SKIP LIST DATA STRUCTURE Linked lists were used in skip list data structure and it aimed to facilitate searching, insertion and deletion through placing elements in a pyramid-like order at different levels.In this data structure, elements were placed at different levels randomly.
First, all nodes were placed at level 0 and, starting from left row and skipping each 2 i th node (i=0,..,MaxLevel (15 or 31)), pointers representing each level are created towards the top.The list at level 0 is the linked list at the bottom in skip list data structure and encompasses all nodes.Each list from bottom to the top were arranged as an index of the previous list [1], [19] (Fig. 2).
When levels in skip list data structure were created (level 0, level 1,.., level k), it was done randomly (Pugh's random Level algorithm [8]; for P=1/4 ).Let us say that the number of ordered nodes in skip list data structure is N. Level 0 consists of these entire N ordered nodes (Fig. 4-Level 0).
Level 1 is created if every other element of the list at Level 0 has also an extra link to the element four ahead of it (Fig. 4 -Level 1).Since the maximum number of elements at Level 1 level equals to   1 4  N , so on, the data structure will be constructed.
The height of skip list depends on the probability P threshold value given in Pugh's -random Level algorithm‖.The effects of P threshold values were studied in a previous study [2] and skip list is more efficient when P threshold value is equal to 1/4.While if P=1/2, the height of skip list approaches to height of balanced tree (lgN).If P=1/4, one out of every four nodes in Level 0 copied to Level 1 (an upper level), and this process was continued in the same way until all data structure were constructed.This process resulted in the height of skip list will be half of the height of the balanced tree.These cases are seen in Fig. 2 and Fig. 4 respectively.
A group of data consisting of the elements {zinc, bee, fox, hill, dive, lift, null, total, vary, other, see} on a skip list shown in Fig. 2. The true skip list structure, which was constituted from these elements, is shown in Fig. 3. Time complexity is O(N) for search, insertion and deletion processes when linked and ordered lists are used.On the other hand, the time complexity is O(lg N) in skip list data structure [8], [15] when the same process were performed.
In a search algorithm, a node was searched from upper levels to lower levels.During insertion, first, the node to be inserted was searched.If not found, new value is inserted to the matching location starting from a random level and pointers and lists are updated.The process was repeated for other levels where a node is to be inserted.Search was performed from the top level to lower levels for removal operations.The node was deleted when found and pointers and lists were updated.The process was repeated on other levels where the node is available [2].

IV. PRIORITY SEARCH AND BINARY SEARCH
The innovative search algorithm which was called priority search uses the skip list data structure.It was benefited from the pyramidal layered-structure of the skip list data structure.The standard searching algorithm (algorithm 1) in the skip list data structure starts at top-level to the lowest level until it finds the searching data or it ends up in the lowest level.The developed new searching algorithm (Algorithm 2) was based on the hit search number for each searched data.If a datum has greater hit search number, then it was upgraded in the skip list data structure to upper level.That is, the mostly searched data were located in the upper levels of the skip list data structure and rarely searched data were located in the lower levels of the skip list data structure.The time complexity of searching in the skip list data structure (Algorithm 1) is O(lgN), but the time complexity of searching algorithm in priority search (Algorithm 2) approximates to (1).In another word, the mostly searched data were located in the top-level of the skip list data structure, thus, the searching for these data has time complexity as ~ (1).The rarely searched data were located in the lowest level and their searching time complexities approximate to O(lgN).The time complexity of searching by using priority search algorithm changes between (1)-O(lgN).
When ‗dive' two times, ‗null' four times and ‗vary' three times were searched as in Table I, the results in Table II will be obtained.The skip list data structure for data in Table II is seen in Fig. 5, in which priority search algorithm (Algorithm 2) was used.It was performed by using frequencies (hit search numbers).That is, the searched data is upgraded once for each search process.Therefore, the mostly searched data were located at the top of skip list data structure (pyramidal structure) and rarely searched data were located at the bottom of skip list data structure.The priority search algorithm was used in the skip list data structure due to its pyramidal structure.Additionally, the standard search algorithm (Algorithm 1) for the skip list of size N has time complexity as O(lgN).Data were sorted in ascending order in the skip list data structure when skip list data structure were constructed (Fig. 5 Level0, Level1, Level2, Level 3, and Level 4).The most important property of skip list data structure is its pyramidal structure and ordered data in it.
The searching process started at the first element in the list and carried on till the end of list, when data were unordered.www.ijacsa.thesai.orgSo, the searching algorithm is a linear algorithm in term of the number of data in the list.The time complexity of linear search is O(N).The searching process considered the data as unordered whether data were ordered or not.But it is not a suitable search process for ordered data [16], [17], [21].

HEAD->next[lvl] = update[lvl]->next[lvl] update[lvl]->next[lvl] = HEAD; return true end if if(HEAD->next[LEVEL]->value<search_value) HEAD= HEAD->next[LEVEL] if(HEAD->next[LEVEL]->value>search_value)
LEVEL=LEVEL-1 end while return false; Another searching algorithm is binary search algorithm for ordered data.In order to use this algorithm, data have to be ordered on the list.If data were unordered, initially they must be ordered by using any sorting algorithm.
The mechanism of binary searching algorithm is as follows [15], [16], [18], [20]:  If list or array is not sorted, it is firstly sorted.
 Sorted array is divided into two equal sub-arrays or approximately equal sub-arrays.
 The searched data is compared with the middle element of array.If it is equal then, it is found.If searched data is less than the middle element of array, then right subarray is discarded and data will be searched in the left sub-array.If searched data are greater than the middle element of array, then searched data will be searched in the right sub-array.
 The searched data will be scanned on the left or right sub-array in the same manner.
 The process goes on in the same manner until searched data is found or search is terminated.
The time complexity of binary search algorithm is O(lgN) for an array of size N elements.Moreover, the time complexity of binary search for balanced binary trees is also O(lgN).www.ijacsa.thesai.orgV.
EXPERIMENTAL RESULTS: PRIORITY SEARCH AND OTHERS The proposed algorithm was implemented by using C++ and tested successfully on distinct arrays.In order to compare Priority Search (PS), Linear Search (LS), and Binary Search (BS), random arrays and sorted arrays were used.The searching times of PS, LS and BS for sizes from 1000 to 100000 of arrays were illustrated in the Table III and Table IV.Moreover, each algorithm was applied to same size arrays 100 times and all times for all executions was added up and then their average was computed.This means that the effect of data permutation will be minimized and the comparison will be more equitable.If there is one search for algorithm, the comparisons may be non-equitable.For example, searched data for PS may be on the top level of skip list data structure, and then its time will be (1).If the searched data for BS is not found in the binary search tree, then its time will be longer.This case may be available for each search algorithm.Due to this case, there were 100 executions for equitable comparisons of search algorithms.
All results were obtained on the same computer and the results in Table III and Table IV demonstrated that when size of array is small, BS shows normal performance; when the size of array increases, the performance of PS increases and PS is better than LS and BS.The results were illustrated in Fig. 6.Table III, Table IV and Fig. 6, Fig. 7 depict that PS is better than LS and BS with respect to searching time.The time complexities for searching PS, and BS on sorted arrays are O(lgN).The time complexities for searching LS on sorted array is O(N).While computing time complexity for any algorithm, the dominant (term with the greatest degree) term is regarded as time complexity.The asymptotic behaviors of PS and BS are similar; however, the constant coefficients are different and this case makes PS be the best algorithm.IV; PS algorithm has better performance than LS and BS.Moreover, PS algorithm is better than BS algorithm as seen in Fig. 7. Searched data in PS algorithm were located to the top of Skip List, hence time complexity will be (1) for these data.The results in Table III were obtained when the searched data were located near to the beginning of array.Whereas, Table IV shows the situation where the searched data were located near to the end of the array.Comparing the results of LS algorithm in both tables, it was seen that the search time increases if the data were located at the end of array.However, the results were the same for BS and PS algorithms no matter where the searched data was located.When arrays are unsorted, the performance of linear search algorithm is better than the other algorithms, since remaining algorithms require the sorted arrays to show better performances.

A. Significance of work
Priority search algorithm locates the most searched data to the top of the pyramid-shaped skip list data structure.For these reason, enabling time complexity (1) of frequent searched data were important.
The priority search algorithm may be used in the search engine like Google, Yandex, etc.The greater frequency (search hit number) the upper level for searched data; the smaller frequency the lower level for searched data.The mostly searched data were located in the top level of skip list data structure, so, searching this data will take less time.The rarely searched data were located in the lowest level of the skip list data structure, so, its searching time will take longer.If searching process was grouped with respect to frequencies of data, the searching would be easier.There many data (may be billion data, etc.) in the internet.If data were located in a large skip list data structure for search engine, it would be more advantageous.
This data structure is also advantageous for dictionary operations, since the most hit data will be on the top level of skip list data structure and its searching will take shorter time; the least hit data will be on the lowest level of the skip list data structure and its searching time will take longer time.

VI. CONCLUSION
Skip list data structure was created with the help of linked list data structures.Thanks to its layered structure, skip list data structure presented in this study reduces the time complexity of search, insertion and deletion processes in linked list data structure to O(lgN), which was O(N).
The applications of linear search, binary search and priority search were realized, and obtained results were compared.The obtained results verified that priority search was better than the linear search and binary search considering the applications.Priority search superior than binary searching and linear searching due to its application results.The time complexity of priority search algorithm was between (1)-O(lgN); the most searched data has time complexity as (1), the least searched data has time complexity as O(lgN).
To summary priority search algorithm could be used in searching processes more efficiently.It enables saving remarkable time when larger sets of data were handled.

Fig. 6 .
Fig. 6.Performance comparison for LS, BS, PS (If the searched data are in middle of array)

TABLE II .
FREQUENCY-WISE LEVEL DISTRIBUTION OF NODES ON FIG.5

TABLE III .
SEARCHING TIMESFOR LS, BS AND PS FOR SORTED ARRAYS (IF THE SEARCHED DATA ARE NEAR TO THE BEGINING OF ARRAY) (MS=MILLISECOND)

TABLE IV .
SEARCHING TIMES FOR LS, BS AND PS FOR SORTED ARRAYS (IF THE SEARCHED DATA ARE NEAR TO THE END OF ARRAY) (MS=MILLISECOND)