Sort a list in python and then return the index of elements in sorted order.
Input : [2, 3, 1, 4, 5] Output : [2, 0, 1, 3, 4] After sorting list becomes [1, 2, 3, 4, 5] and their index as [2, 0, 1, 3, 4] Input : [6, 4, 7, 8, 1] Output : [4, 1, 0, 2, 3] After sorting the list becomes [1, 4, 6, 7, 8] and their index as [4, 1, 0, 2, 3].
[2, 0, 1, 3, 4]
[2, 0, 1, 3, 4]
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Returning Multiple Values in Python
- Returning a function from a function - Python
- Merge K sorted Doubly Linked List in Sorted Order
- Python | Sort list of list by specified index
- Python | Replace elements in second list with index of same element in first list
- Python | Add list elements with a multi-list based on index
- Python - Sort dictionaries list by Key's Value list index
- Python - Filter the List of String whose index in second List contaons the given Substring
- Python | Convert list of string into sorted list of integer
- Python | Indices of sorted list of list elements
- heapq in Python to print all elements in sorted order from row and column wise sorted matrix
- Dunn index and DB index - Cluster Validity indices | Set 1
- Sort Array such that smallest is at 0th index and next smallest it at last index and so on
- Print index of columns sorted by count of zeroes in the Given Matrix
- Sort a nearly sorted (or K sorted) array
- Maximum number of partitions that can be sorted individually to make sorted
- Python | Index of Non-Zero elements in Python list
- Python | Convert list of string to list of list
- Python | Convert list of tuples to list of list
- Python | Convert List of String List to String List
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.