-
Notifications
You must be signed in to change notification settings - Fork 0
sam-klok/ArraysRotation
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Hi... I'm getting back to simple algorithmical exercies. Here I'm giving various solutions, some of them better, in my opinion, than requested by sites like Hacker Rank. So. The fastest algoritm is with small temp array (size equal to shift). The most beautiful algoritm is the slowest. It's algoritm with cyclical shift. In the middle it the simpliest copy in a new array. Relatively fast, but ugly. See performance test. sam klok Notes: Some solutions are on Stack Overflow: https://stackoverflow.com/questions/38482696/how-to-efficiently-rotate-an-array See task on Hacker Rank: https://www.hackerrank.com/challenges/array-left-rotation/problem A left rotation operation on an array of size shifts each of the array's elements unit to the left. Given an integer, rotate the array that many steps left and return the result. Sample Input 5 4 1 2 3 4 5 Sample Output 5 1 2 3 4
About
Arrays Rotation
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published