R Data Structures and Algorithms by Dr. PKS Prakash & Achyutuni Sri Krishna Rao
Author:Dr. PKS Prakash & Achyutuni Sri Krishna Rao [Prakash, Dr. PKS]
Language: eng
Format: azw3, pdf
Publisher: Packt Publishing
Published: 2016-11-20T16:00:00+00:00
The approaches discussed in the first two sections are more effective in implementation while using an in-memory-(single node) based system, and the third approach discussed is more effective in implementation while using either in-memory-(single node) or disks (multiple nodes) based systems.
Searching unsorted and sorted vectors
Vectors are simple and widely used data structures used to perform search operations in R. The simplest form of search operation performed on vectors is a linear search or sequential search. In a linear search, each element is compared sequentially within the vector, and then suitable insertions or deletions are performed. Consider an element, S which is to be searched in an unsorted vector, V of length n (indexed from 1 to n). If the element S is not present in vector V, then a minimum of n comparisons are performed, and if it is present in V at position i, then a minimum of i comparisons are performed. In both scenarios, the number of comparisons is linear, resulting in O(n) as the functional form of system runtime for sequential search in the worst case scenario. The following R code performs a linear search of element S in a vector V of length n:
Sequential_search <- function(V,S,n) { i=1 present = FALSE while(i <= n & present==FALSE) { if(V[i] == S) present=TRUE else i = i+1 } return(list(present=present,key=i)) }
Figure 6.1 illustrates two different sequential operations. Part (a) represents the situation wherein the element S is not present, and Part (b) represents the presence of element S. Each step corresponds to a comparison, regardless of whether the current element in the vector is equal to S or not:
Download
R Data Structures and Algorithms by Dr. PKS Prakash & Achyutuni Sri Krishna Rao.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12566)
Hello! Python by Anthony Briggs(9911)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9795)
The Mikado Method by Ola Ellnestam Daniel Brolund(9775)
Dependency Injection in .NET by Mark Seemann(9336)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8293)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7758)
Grails in Action by Glen Smith Peter Ledbrook(7693)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7027)
Microservices with Go by Alexander Shuiskov(6794)
Practical Design Patterns for Java Developers by Miroslav Wengner(6706)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6647)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Angular Projects - Third Edition by Aristeidis Bampakos(6055)
The Art of Crafting User Stories by The Art of Crafting User Stories(5587)
NetSuite for Consultants - Second Edition by Peter Ries(5520)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5324)
Kotlin in Action by Dmitry Jemerov(5062)
