Compact Trie Forest: Scalable Architecture for IP Lookup on Fpgas

Total Page:16

File Type:pdf, Size:1020Kb

Compact Trie Forest: Scalable Architecture for IP Lookup on Fpgas Compact Trie Forest: Scalable architecture for IP Lookup on FPGAs Oguzhan˘ Erdem Aydin Carus Hoang Le Electrical and Electronics Engineering Computer Engineering Electrical Engineering Trakya University Trakya University University of Southern California Edirne, TURKEY 22030 Edirne, TURKEY 22030 Los Angeles, USA 90007 Email: [email protected] Email: [email protected] Email: [email protected] Abstract—Memory efficiency with compact data structures pipelining techniques are used to improve the through- for Internet Protocol (IP) lookup has recently regained much put. However, pipelined hardware implementation of these interest in the research community. In this paper, we revisit algorithms suffer from inefficient memory usage due to the classic trie-based approach for solving the longest prefix matching (LPM) problem used in IP lookup. Among all existing unbalanced mapping of tree onto the pipeline stages. implementation platforms, Field Programmable Gate Array We propose a compact trie forest data structure for trie- (FPGA) is a prevailing platform to implement SRAM-based based IP lookup. The search data structure is realized on pipelined architectures for high-speed IP lookup because of its a scalable high-throughput, SRAM-based linear pipeline abundant parallelism and other desirable features. However, architecture. Additionally, this design utilizes the dual-ported due to the available on-chip memory and the number of I/O pins of FPGAs, state-of-the-art designs cannot support large feature of on-chip memory on FPGAs to achieve high routing tables consisting of over 350K prefixes in backbone throughput. This paper makes the following contributions: routers. 1) A Compact trie (CT) structure that achieves a better We propose a search algorithm and data structure denoted memory efficiency compared with that of the tradi- Compact Trie (CT) for IP lookup. Our algorithm demonstrates a substantial reduction in the memory footprint compared with tional binary trie (Section III). the state-of-the-art solutions. A parallel architecture on FPGAs, 2) A Compact trie forest (CTF) consisting of multiple named Compact Trie Forest (CTF), is introduced to support the CTs to eliminate the backtracking problem in CTs. data structure. Along with pipelining techniques, our optimized These CTs are searched in parallel for high perfor- architecture also employs multiple memory banks in each mance IP lookup, taking advantages of the abundant stage to further reduce memory and resource redundancy. Implementation on a state-of-the-art FPGA device shows that parallelism provided by state-of-the-art FPGAs (Sec- the proposed architecture can support large routing tables tion III). consisting up to 703K IPv4 or 418K IPv6 prefixes. The post 3) A linear pipelined SRAM-based architecture that can place-and-route result shows that our architecture can sustain be easily implemented in hardware. Our optimized 420 a throughput of million lookups per second (MLPS), or architecture also employs multiple memory banks to 135 Gbps for the minimum packet size of 40 Bytes. The result surpasses the worst-case 150 MLPS required by the further improve memory efficiency (Section IV). standardized 100GbE line cards. 4) A design that can support up to 703K IPv4 and 418K IPv6 prefixes, using a state-of-the-art FPGA I. INTRODUCTION device. The post place-and-route result shows that our architecture can sustain a throughput of 420 million Most hardware-based solutions for network routers fall lookups per second, or 135 Gbps for the minimum into two main categories: Ternary Content Addressable packet size of 40 Bytes (Section V). Memory (TCAM)-based and dynamic/static random access The rest of the paper is organized as follows. Section II memory (DRAM/SRAM)-based solutions. In TCAM-based covers the background and overviews the existing solutions solutions, each prefix is stored in a word and an incoming for IP lookup. Section III presents in detail the algorithms IP address is compared in parallel with all the entries and data structures for CTF. Section IV introduces the in TCAM in one clock cycle. TCAM-based solutions are proposed architecture and its implementation on FPGA. simple, and therefore, are de-facto solutions for today’s Section V presents experimental setup and implementation routers. However, TCAMs are expensive, power-hungry, results. Section VI concludes the paper. and offer little adaptability to new addressing and routing protocols. On the other hand, SRAM has higher density, II. BACKGROUND lower power consumption, and higher speed. The common data structure in SRAM-based solutions is some form of tree. A. IP Lookup Overview In these solutions, multiple memory accesses are required IP packet forwarding, or simply, IP-lookup, is a classic in order to find the search result. Therefore, FPGA based problem. In computer networking, a routing table is a 978-1-4673-2921-7/12/$31.00 c 2012 IEEE database that is stored in a router or a networked computer. some pre-defined lengths to compare directly with the input The routing table stores the routes and metrics associated address. In a binary search tree (BST), each node has a value with those routes, such as next hop routing indices, to (prefix) and an associated next hop index. The left subtree of particular network destinations. The IP-lookup problem is that node contains only values less than or equal to the nodes referred to as “longest prefix matching” (LPM), which is value, and the right subtree contains values greater than the used by routers in IP networking to select an entry from nodes value. Pipelined BST-based IP lookup solutions are the given routing table. To determine the outgoing port for limited by the complex pre-processing required to convert a given address, the longest matching prefix among all the routing prefixes into exclusive ranges and sort them. Using prefixes needs to be determined. Routing tables often contain this structure is also difficult to perform incremental updates. a default route in case matches with all other entries fail. III. ALGORITHM AND DATA STRUCTURE B. Related Work A. Definitions and Notations Various hardware based IP lookup solutions on FPGAs have been proposed in recent years. In general, these FPGA- The following notations are used throughout the paper: based approaches can be classified into four categories: (1) MSB - Most Significant Bit, LSB - Least Significant Bit, linear pattern search in TCAM [1], [2], (2) hash based solu- MSSB - Most Significant Set Bit, LSSB - Least Significant Set Bit, MSRB - Most Significant Reset Bit, LSRB - Least tions [3], [4], (3) binary bit traversal in pipelined tries [5]– ∗ [8], and (4) binary value search in pipelined trees [9], [10]. Significant Reset Bit. For instance, prefix 00110101 has 0 TCAM-based solutions are simple, but they are expensive, and 1 values as MSB and LSB; 2, 7, 0 and 6 values for power-hungry, and offer little adaptability to new addressing MSSB, LSSB, MSRB and LSRB positions. and routing protocols. Hash based IP lookup schemes have Definition Prefix node in a trie is any node to which a several disadvantages; (a) large number of different hash path from the root of the trie corresponds to an entry in the tables may be required to store routing prefixes of different routing table. If there is no valid prefix stored in a trie node, lengths, (b) use of separate hash functions for each length then it is called non-prefix node. is impractical, (c) it is hard to find perfect hash functions Active part to minimize bin overflows, and (d) an additional memory Definition (AP) of a prefix is the bit string (CAM, etc.) needs to be reserved for resolving overflows. between The most common and simple data structure for IP lookup 1) MSSB and LSSB bits for (MSB,LSB)=(0,0) is the binary trie. These trie-based solutions achieve good 2) MSSB and LSRB bits for (MSB,LSB)=(0,1) throughput performance and support quick prefix updates. 3) MSRB and LSSB bits for (MSB,LSB)=(1,0) In such a trie, the path from the root to a node represents 4) MSRB and LSRB bits for (MSB,LSB)=(1,1) a prefix in a routing table. Fig. 1 illustrates a sample of a prefix excluding the both MSS(R)B and LSS(R)B bits. prefix table and its corresponding binary trie. In this figure, For example, the active parts of the prefixes 011011∗ and each black node corresponds to a prefix. Multiple memory 00101100∗ are 1 and 01, respectively. accesses are required to find the longest matched prefix. Definition If two prefixes have the same active part, then Therefore, pipelining techniques are used to improve the they are called conflicted prefixes. For instance, the prefixes throughput. However, pipelined hardware implementation of 011001∗ and 0011010∗ are conflicted because they both this algorithm suffers from inefficient memory usage due to have the same active part of 10. unbalanced mapping of tree onto the pipeline stages. B. Prefix Table Conversion Next Prefix Hop 0 1 11* P1 A prefix p can be expressed as the concatenation of three 111* P2 0101* P3 0 110 substrings x, y and z, such that p = xyz. In this notation, 00101* P4 01001* P5 P1 x is a string composed of only 0’s followed by a single 01110* P6 0 1 0 1 0 0 1 10001* P7 11001* P8 P2 1 (MSSB), or only 1’s followed by a single 0 (MSRB). z 11010* P9 1 0 0 1 1 0 1 0 1 0 000101 P10 is a string composed of a 1 (LSSB) followed by 0’s, or a 001010 P11 010001 P12 0 1 0 P3 1 1 1 001 1 p xyz 011101 P13 0 (LSRB) followed by 1’s. Alternatively, prefix = 011110 P14 {|x|,y,|z|} 100011 P15 1 0 P4 P5 P6 P7 0 1 P8 P9 0 can be represented as a triplet .
Recommended publications
  • Search Trees
    Lecture III Page 1 “Trees are the earth’s endless effort to speak to the listening heaven.” – Rabindranath Tagore, Fireflies, 1928 Alice was walking beside the White Knight in Looking Glass Land. ”You are sad.” the Knight said in an anxious tone: ”let me sing you a song to comfort you.” ”Is it very long?” Alice asked, for she had heard a good deal of poetry that day. ”It’s long.” said the Knight, ”but it’s very, very beautiful. Everybody that hears me sing it - either it brings tears to their eyes, or else -” ”Or else what?” said Alice, for the Knight had made a sudden pause. ”Or else it doesn’t, you know. The name of the song is called ’Haddocks’ Eyes.’” ”Oh, that’s the name of the song, is it?” Alice said, trying to feel interested. ”No, you don’t understand,” the Knight said, looking a little vexed. ”That’s what the name is called. The name really is ’The Aged, Aged Man.’” ”Then I ought to have said ’That’s what the song is called’?” Alice corrected herself. ”No you oughtn’t: that’s another thing. The song is called ’Ways and Means’ but that’s only what it’s called, you know!” ”Well, what is the song then?” said Alice, who was by this time completely bewildered. ”I was coming to that,” the Knight said. ”The song really is ’A-sitting On a Gate’: and the tune’s my own invention.” So saying, he stopped his horse and let the reins fall on its neck: then slowly beating time with one hand, and with a faint smile lighting up his gentle, foolish face, he began..
    [Show full text]
  • Lock-Free Search Data Structures: Throughput Modeling with Poisson Processes
    Lock-Free Search Data Structures: Throughput Modeling with Poisson Processes Aras Atalar Chalmers University of Technology, S-41296 Göteborg, Sweden [email protected] Paul Renaud-Goud Informatics Research Institute of Toulouse, F-31062 Toulouse, France [email protected] Philippas Tsigas Chalmers University of Technology, S-41296 Göteborg, Sweden [email protected] Abstract This paper considers the modeling and the analysis of the performance of lock-free concurrent search data structures. Our analysis considers such lock-free data structures that are utilized through a sequence of operations which are generated with a memoryless and stationary access pattern. Our main contribution is a new way of analyzing lock-free concurrent search data structures: our execution model matches with the behavior that we observe in practice and achieves good throughput predictions. Search data structures are formed of basic blocks, usually referred to as nodes, which can be accessed by two kinds of events, characterized by their latencies; (i) CAS events originated as a result of modifications of the search data structure (ii) Read events that occur during traversals. An operation triggers a set of events, and the running time of an operation is computed as the sum of the latencies of these events. We identify the factors that impact the latency of such events on a multi-core shared memory system. The main challenge (though not the only one) is that the latency of each event mainly depends on the state of the caches at the time when it is triggered, and the state of caches is changing due to events that are triggered by the operations of any thread in the system.
    [Show full text]
  • Persistent Predecessor Search and Orthogonal Point Location on the Word
    Persistent Predecessor Search and Orthogonal Point Location on the Word RAM∗ Timothy M. Chan† August 17, 2012 Abstract We answer a basic data structuring question (for example, raised by Dietz and Raman [1991]): can van Emde Boas trees be made persistent, without changing their asymptotic query/update time? We present a (partially) persistent data structure that supports predecessor search in a set of integers in 1,...,U under an arbitrary sequence of n insertions and deletions, with O(log log U) { } expected query time and expected amortized update time, and O(n) space. The query bound is optimal in U for linear-space structures and improves previous near-O((log log U)2) methods. The same method solves a fundamental problem from computational geometry: point location in orthogonal planar subdivisions (where edges are vertical or horizontal). We obtain the first static data structure achieving O(log log U) worst-case query time and linear space. This result is again optimal in U for linear-space structures and improves the previous O((log log U)2) method by de Berg, Snoeyink, and van Kreveld [1995]. The same result also holds for higher-dimensional subdivisions that are orthogonal binary space partitions, and for certain nonorthogonal planar subdivisions such as triangulations without small angles. Many geometric applications follow, including improved query times for orthogonal range reporting for dimensions 3 on the RAM. ≥ Our key technique is an interesting new van-Emde-Boas–style recursion that alternates be- tween two strategies, both quite simple. 1 Introduction Van Emde Boas trees [60, 61, 62] are fundamental data structures that support predecessor searches in O(log log U) time on the word RAM with O(n) space, when the n elements of the given set S come from a bounded integer universe 1,...,U (U n).
    [Show full text]
  • Indexing Tree-Based Indexing
    Indexing Chapter 8, 10, 11 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Tree-Based Indexing The data entries are arranged in sorted order by search key value. A hierarchical search data structure (tree) is maintained that directs searches to the correct page of data entries. Tree-structured indexing techniques support both range searches and equality searches. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 2 Trees Tree A structure with a unique starting node (the root), in which each node is capable of having child nodes and a unique path exists from the root to every other node Root The top node of a tree structure; a node with no parent Leaf Node A tree node that has no children Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 3 Trees Level Distance of a node from the root Height The maximum level Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 4 Time Complexity of Tree Operations Time complexity of Searching: . O(height of the tree) Time complexity of Inserting: . O(height of the tree) Time complexity of Deleting: . O(height of the tree) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 5 Multi-way Tree If we relax the restriction that each node can have only one key, we can reduce the height of the tree. A multi-way search tree is a tree in which the nodes hold between 1 to m-1 distinct keys Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 6 Range Searches ``Find all students with gpa > 3.0’’ .
    [Show full text]
  • Lecture III BALANCED SEARCH TREES
    §1. Keyed Search Structures Lecture III Page 1 Lecture III BALANCED SEARCH TREES Anthropologists inform that there is an unusually large number of Eskimo words for snow. The Computer Science equivalent of snow is the tree word: we have (a,b)-tree, AVL tree, B-tree, binary search tree, BSP tree, conjugation tree, dynamic weighted tree, finger tree, half-balanced tree, heaps, interval tree, kd-tree, quadtree, octtree, optimal binary search tree, priority search tree, R-trees, randomized search tree, range tree, red-black tree, segment tree, splay tree, suffix tree, treaps, tries, weight-balanced tree, etc. The above list is restricted to trees used as search data structures. If we include trees arising in specific applications (e.g., Huffman tree, DFS/BFS tree, Eskimo:snow::CS:tree alpha-beta tree), we obtain an even more diverse list. The list can be enlarged to include variants + of these trees: thus there are subspecies of B-trees called B - and B∗-trees, etc. The simplest search tree is the binary search tree. It is usually the first non-trivial data structure that students encounter, after linear structures such as arrays, lists, stacks and queues. Trees are useful for implementing a variety of abstract data types. We shall see that all the common operations for search structures are easily implemented using binary search trees. Algorithms on binary search trees have a worst-case behaviour that is proportional to the height of the tree. The height of a binary tree on n nodes is at least lg n . We say that a family of binary trees is balanced if every tree in the family on n nodes has⌊ height⌋ O(log n).
    [Show full text]
  • Finger Search Trees
    11 Finger Search Trees 11.1 Finger Searching....................................... 11-1 11.2 Dynamic Finger Search Trees ....................... 11-2 11.3 Level Linked (2,4)-Trees .............................. 11-3 11.4 Randomized Finger Search Trees ................... 11-4 Treaps • Skip Lists 11.5 Applications............................................ 11-6 Optimal Merging and Set Operations • Arbitrary Gerth Stølting Brodal Merging Order • List Splitting • Adaptive Merging and University of Aarhus Sorting 11.1 Finger Searching One of the most studied problems in computer science is the problem of maintaining a sorted sequence of elements to facilitate efficient searches. The prominent solution to the problem is to organize the sorted sequence as a balanced search tree, enabling insertions, deletions and searches in logarithmic time. Many different search trees have been developed and studied intensively in the literature. A discussion of balanced binary search trees can e.g. be found in [4]. This chapter is devoted to finger search trees which are search trees supporting fingers, i.e. pointers, to elements in the search trees and supporting efficient updates and searches in the vicinity of the fingers. If the sorted sequence is a static set of n elements then a simple and space efficient representation is a sorted array. Searches can be performed by binary search using 1+⌊log n⌋ comparisons (we throughout this chapter let log x denote log2 max{2, x}). A finger search starting at a particular element of the array can be performed by an exponential search by inspecting elements at distance 2i − 1 from the finger for increasing i followed by a binary search in a range of 2⌊log d⌋ − 1 elements, where d is the rank difference in the sequence between the finger and the search element.
    [Show full text]
  • Data Structure for Language Processing
    Data Structure for Language Processing Bhargavi H. Goswami Assistant Professor Sunshine Group of Institutions INTRODUCTION: • Which operation is frequently used by a Language Processor? • Ans: Search. • This makes the design of data structures a crucial issue in language processing activities. • In this chapter we shall discuss the data structure requirements of LP and suggest efficient data structure to meet there requirements. Criteria for Classification of Data Structure of LP: • 1. Nature of Data Structure: whether a “linear” or “non linear”. • 2. Purpose of Data Structure: whether a “search” DS or an “allocation” DS. • 3. Lifetime of a data structure: whether used during language processing or during target program execution. Linear DS • Linear data structure consist of a linear arrangement of elements in the memory. • Advantage: Facilitates Efficient Search. • Dis-Advantage: Require a contagious area of memory. • Do u consider it a problem? Yes or No? • What the problem is? • Size of a data structure is difficult to predict. • So designer is forced to overestimate the memory requirements of a linear DS to ensure that it does not outgrow the allocated memory. • Disadvantage: Wastage Of Memory. Non Linear DS • Overcomes the disadvantage of Linear DS. HOW? • Elements of Non Linear DS are accessed using pointers. • Hence the elements need not occupy contiguous areas of memory. • Disadvantage: Non Linear DS leads to lower search efficiency. Linear & Non-Linear DS E F B E A H G F F H D C Linear Non Linear Search Data Structures • Search DS are used during LP’ing to maintain attribute information concerning different entities in source program.
    [Show full text]
  • Dynamic Interpolation Search Revisited
    Information and Computation 270 (2020) 104465 Contents lists available at ScienceDirect Information and Computation www.elsevier.com/locate/yinco ✩ Dynamic Interpolation Search revisited Alexis Kaporis a, Christos Makris b, Spyros Sioutas b, Athanasios Tsakalidis b, ∗ Kostas Tsichlas d, Christos Zaroliagis b,c, a Department of Information & Communication Systems Engineering, University of the Aegean, Karlovassi, Samos, 83200, Greece b Department of Computer Engineering and Informatics, University of Patras, 26500 Patras, Greece c Computer Technology Institute & Press “Diophantus”, N. Kazantzaki Str, Patras University Campus, 26504 Patras, Greece d Department of Informatics, Aristotle University of Thessaloniki, Greece a r t i c l e i n f o a b s t r a c t Article history: A new dynamic Interpolation Search (IS) data structure is presented that achieves Received 11 June 2018 O (log logn) search time with high probability on unknown continuous or even discrete Received in revised form 19 February 2019 input distributions with measurable probability of element collisions, including power law Accepted 15 March 2019 and Binomial distributions. No such previous result holds for IS when the probability of Available online 4 September 2019 element collisions is measurable. Moreover, our data structure exhibits O (1) search time Keywords: with high probability (w.h.p.) for a wide class of input distributions that contains all those Interpolation Search for which o(log logn) expected search time was previously known. © Dynamic predecessor search 2019 Elsevier Inc. All rights reserved. Dynamic search data structure 1. Introduction The dynamic predecessor search problem is one of the fundamental problems in computer science. In this problem we have to maintain a set of elements subject to insertions and deletions such that given a query element y we can retrieve the largest element in the set smaller or equal to y.
    [Show full text]
  • CMSC 420 Data Structures1
    CMSC 420 Data Structures1 David M. Mount Department of Computer Science University of Maryland Fall 2019 1 Copyright, David M. Mount, 2019, Dept. of Computer Science, University of Maryland, College Park, MD, 20742. These lecture notes were prepared by David Mount for the course CMSC 420, Data Structures, at the University of Maryland. Permission to use, copy, modify, and distribute these notes for educational purposes and without fee is hereby granted, provided that this copyright notice appear in all copies. Lecture Notes 1 CMSC 420 Lecture 1: Course Introduction and Background Algorithms and Data Structures: The study of data structures and the algorithms that ma- nipulate them is among the most fundamental topics in computer science. Most of what computer systems spend their time doing is storing, accessing, and manipulating data in one form or another. Some examples from computer science include: Information Retrieval: List the 10 most informative Web pages on the subject of \how to treat high blood pressure?" Identify possible suspects of a crime based on fingerprints or DNA evidence. Find movies that a Netflix subscriber may like based on the movies that this person has already viewed. Find images on the Internet containing both kangaroos and horses. Geographic Information Systems: How many people in the USA live within 25 miles of the Mississippi River? List the 10 movie theaters that are closest to my current location. If sea levels rise 10 meters, what fraction of Florida will be under water? Compilers: You need to store a set of variable names along with their associated types. Given an assignment between two variables we need to look them up in a symbol table, determine their types, and determine whether it is possible to cast from one type to the other).
    [Show full text]
  • Algorithms and Data Structures for IP Lookup, Packet Classification And
    Dissertation zur Erlangung des Doktorgrades der FakultÄatfÄurAngewandte Wissenschaften der Albert-Ludwigs-UniversitÄatFreiburg Algorithms and Data Structures for IP Lookup, Packet Classi¯cation and Conflict Detection Christine Maindorfer Betreuer: Prof. Dr. Thomas Ottmann Dekan der FakultÄatfÄurAngewandte Wissenschaften: Prof. Dr. Hans Zappe Betreuer: Prof. Dr. Thomas Ottmann Zweitgutachterin: Prof. Dr. Susanne Albers Tag der Disputation: 2.3.2009 Zusammenfassung Die Hauptaufgabe eines Internet-Routers besteht in der Weiterleitung von Paketen. Um den nÄachsten Router auf dem Weg zum Ziel zu bestimmen, wird der Header, welcher u.a. die Zieladresse enthÄalt,eines jeden Datenpaketes inspiziert und gegen eine Routertabelle abgeglichen. Im Falle, dass mehrere PrÄa¯xein der Routertabelle mit der Zieladresse Äubereinstimmen, wird in der Regel eine Strategie gewÄahlt,die als \Longest Pre¯x Matching" bekannt ist. Hierbei wird von allen mÄoglichen Aktio- nen diejenige ausgewÄahlt,die durch das lÄangstemit der Adresse Äubereinstimmende PrÄa¯xfestgelegt ist. Zur LÄosungdieses sogenannten IP-Lookup-Problems sind zahlreiche Algorithmen und Datenstrukturen vorgeschlagen worden. AnderungenÄ in der Netzwerktopologie aufgrund von physikalischen Verbindungsaus- fÄallen,der Hinzunahme von neuen Routern oder Verbindungen fÄuhrenzu Aktu- alisierungen in den Routertabellen. Da die Performanz der IP-Lookup-Einheit einen entscheidenden Einfluss auf die Gesamtperformanz des Internets hat, ist es entscheidend, dass IP-Lookup sowie Aktualisierungen so schnell wie mÄoglich durchgefÄuhrtwerden. Um diese Operationen zu beschleunigen, sollten Routerta- bellen so implementiert werden, dass Lookup und Aktualisierungen gleichzeitig ausgefÄuhrtwerden kÄonnen.Um zu sichern, dass auf SuchbÄaumenbasierte dynami- sche Routertabellen nicht durch Updates degenerieren, unterlegt man diese mit einer balancierten Suchbaumklasse. Relaxierte Balancierung ist ein gebrÄauchliches Konzept im Design von nebenlÄau¯gimplementierten SuchbÄaumen. Hierbei wer- den die Balanceoperationen ggf.
    [Show full text]
  • Data Structures and Algorithms (CS210A) Semester I – 2014-15
    Data Structures and Algorithms (CS210A) Semester I – 2014-15 Lecture 39 • Integer sorting : Radix Sort • Search data structure for integers : Hashing 1 Types of sorting algorithms In Place Sorting algorithm: A sorting algorithm which uses only O(1) extra space to sort. Example: Heap sort, Quick sort. Stable Sorting algorithm: A sorting algorithm which preserves the order of equal keys while sorting. 0 1 2 3 4 5 6 7 A 2 5 3 0 6.1 3 7.9 4 0 1 2 3 4 5 6 7 A 0 2 3 3 4 5 6.1 7.9 Example: Merge sort. 2 Integer Sorting algorithms Continued from last class Counting sort: algorithm for sorting integers Input: An array A storing 풏 integers in the range [0…풌 − ퟏ]. Output: Sorted array A. Running time: O(풏 + 풌) in word RAM model of computation. Extra space: O(풏 + 풌) Counting sort: a visual description 0 1 2 3 4 5 6 7 A 2 5 3 0 2 3 0 3 We couldWhy have did we used scan Count 0 1 2 3 4 5 arrayelements only ofto Aoutput in reverse the orderelements (from indexof A in 풏 sorted− ퟏ to ퟎ) Count 2 0 2 3 0 1 whileorder. placing Why did them we incompute the final sortedPlace andarray B B? ? 0 1 2 3 4 5 Place 21 2 4 67 7 8 Answer:Answer: TheTo inputensure might that beCounting an array sort of recordsis stable and. theThe aim reason to sort why these stability records is required according will tob someecome integer clear soonfield.
    [Show full text]
  • Comparison of Search Data Structures and Their Performance Evaluation with Detailed Analysis
    International Journal of Scientific & Engineering Research, Volume 4, Issue 4, April 2013 1437 ISSN 2229-5518 Comparison of search data structures and their performance evaluation with detailed analysis S.V.SRIDHAR, P.RAVINDER RAO, E.PRIYADARSHINI,N.VAMSI KRISHNA ABSTRACT: In the field of computer science and information technology , and many other related areas where large volumes of data are present we need to do many operations on those sets of data which are part of processing , analyzing and producing results and related conclusions . so in this paper we present one of the most commonly used operations – SEARCHING in the fields related to information processing. Along with a detailed study on sequential and binary search we also present performance analysis and a detailed technical view on the method of operation of the above said searching methods along with programmatic approach Index Terms— Minimum 7 keywords are mandatory, Keywords should closely reflect the topic and should optimally characterize the paper. Use about four key words or phrases in alphabetical order, separated by commas. I. INTRODUCTION: In computer science, a search data structure is any data structure that allows the efficient retrieval of specific items from a set of items, such as a specific record from a database or searching for the presence of an element among a list of elements. 23 14 8 55 71 31 11 43 12 13 Figure 1 The above picture represents a general list of elements that are saved in memory. Assume that in a particular instance we need to know whether element 71 is present in the above list or not, if present we need to know the position of the element among the above, thereby enabling to access the element if needed , because in the field of computer science a storage operation always occurs by presence of a memory address and a mechanism to access the value present at that location and also a mechanism and store back the value after usage if needed.
    [Show full text]