示例#1
0
 def test1(self):
     array = [-2, -9, -12, 3, 2, 1]
     self.assertEqual(-12, recursive_quickselect(array, 0))
示例#2
0
 def test9(self):
     array = [
         3, 4, 9, 2, 1, -9, -4, 3, 8, -9, 10, 12, 400, 123213, 85, 4, 3, 1,
         2, 3
     ]
     self.assertEqual(-4, recursive_quickselect(array, 2))
示例#3
0
 def test4(self):
     array = [-2, -9, -12, 3, 2, 1]
     self.assertEqual(1, recursive_quickselect(array, 3))
示例#4
0
 def test6(self):
     array = [-2, -9, -12, 3, 2, 1]
     self.assertEqual(None, recursive_quickselect(array, 221))
示例#5
0
 def test2(self):
     array = [-2, -9, -12, 3, 2, 1]
     self.assertEqual(3, recursive_quickselect(array, 5))