{"id":18273,"date":"2021-08-26T10:42:09","date_gmt":"2021-08-26T05:12:09","guid":{"rendered":"https:\/\/python-programs.com\/?p=18273"},"modified":"2021-11-22T18:37:15","modified_gmt":"2021-11-22T13:07:15","slug":"python-program-to-find-the-rotation-count-in-rotated-sorted-list","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-the-rotation-count-in-rotated-sorted-list\/","title":{"rendered":"Python Program to Find the Rotation Count in Rotated Sorted List"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Sort a List in Wave Form<\/a>
\nConsider a List of distinct numbers that are sorted in ascending order. The list has been rotated k times (clockwise). The task is to determine the value of k.<\/p>\n

In simple terms, print the minimum index value to get the rotation count.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given List = [7, 9, 11, 12, 5, 6, 1, 8]<\/pre>\n

Output:<\/strong><\/p>\n

The number of rotations of a gvn_lst [7, 9, 11, 12, 5, 6, 1, 8] = 6<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given List = [6, 3, 1, 4, 7]<\/pre>\n

Output:<\/strong><\/p>\n

The number of rotations of a gvn_lst [6, 3, 1, 4, 7] = 1<\/pre>\n

Program to Find the Rotation Count in Rotated Sorted List in Python<\/h2>\n

Below are the ways to find the rotation count in the rotated sorted list:<\/p>\n