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.
- 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 | Convert list of string into sorted list of integer
- Python - Sort dictionaries list by Key's Value list index
- Python | Indices of sorted list of list elements
- Python | Sort list of list by specified index
- Python list | index()
- Python - Kth Index Tuple List Mean
- Python | Accessing index and value in list
- Python - Every Kth index Maximum in List
- Python - Sort from Kth index in List
- Python - Index Value Summation List
- Python | Check if list is sorted or not
- Python | Check for Nth index existence in list
- Python - K difference index pairing in list
- Python | Subgroups of i'th index size in list
- Python - Values Frequency Index List
- Python - K Maximum elements with Index in List
- Python | Equate two list index elements
- Python - Product of elements using Index 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 firstname.lastname@example.org. 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.