Every line of 'sort 2d list python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
70 def sorted(lst, cmp=None, key=None, reverse=None): 71 "sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list" 72 sorted_lst = list(lst) 73 sorted_lst.sort(cmp, key, reverse) 74 return sorted_lst
455 def Sort(self): 456 r"""Sort(doubleArray self)""" 457 return _array.doubleArray_Sort(self)
909 """ Contains(self: Queue[T], item: T) -> bool """ 910 pass
22 def Quick_Sort(list): 23 Quick(list, 0, len(list) - 1)
13 def selectionSort2(list): 14 for index in range(0,len(list)-1): 15 indexMin = 0 16 for i in range(index+1,len(list)): 17 if list[i] < list[indexMin]: indexMin = i 18 if indexMin > index: 19 temp = list[index] 20 list[index] = list[indexMin] 21 list[indexMin] = temp
134 def ilist(d,l,x,y,z): 135 global threshold 136 137 v=d.get_value_at(x,y,z) 138 if v>threshold : insort(l,(v,x,y,z))
27 def quick_sort(myList, start, end): 28 if start < end: 29 # partitioning the list 30 split = partition(myList, start, end) 31 # split halves & sort both halves 32 quick_sort(myList, start, split - 1) 33 quick_sort(myList, split + 1, end) 34 return myList
356 def test_11_sorting(self): 357 'Sorting' 358 pl, ul = self.lists_of_len() 359 pl.insert(0, pl.pop()) 360 ul.insert(0, ul.pop()) 361 pl.sort() 362 ul.sort() 363 self.assertEqual(pl[:], ul[:], 'sort') 364 mid = pl[len(pl) // 2] 365 pl.sort(key=lambda x: (mid - x) ** 2) 366 ul.sort(key=lambda x: (mid - x) ** 2) 367 self.assertEqual(pl[:], ul[:], 'sort w/ key') 368 369 pl.insert(0, pl.pop()) 370 ul.insert(0, ul.pop()) 371 pl.sort(reverse=True) 372 ul.sort(reverse=True) 373 self.assertEqual(pl[:], ul[:], 'sort w/ reverse') 374 mid = pl[len(pl) // 2] 375 pl.sort(key=lambda x: (mid - x) ** 2) 376 ul.sort(key=lambda x: (mid - x) ** 2) 377 self.assertEqual(pl[:], ul[:], 'sort w/ key')
16 def insertionSort2(list): 17 for index in range(0,len(list)-1): 18 value = list[index] 19 i = index 20 while(i > 0 and list[i-1] > value): 21 list[i] = list[i-1] 22 i = i - 1 23 list[i] = value
10 def unordered_list_cmp(list1, list2): 11 # Check lengths first for slight improvement in performance 12 return len(list1) == len(list2) and sorted(list1) == sorted(list2)