Example #1
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, iterative_quickselect(array, 2))
Example #2
0
 def test6(self):
     array = [-2, -9, -12, 3, 2, 1]
     self.assertEqual(None, iterative_quickselect(array, 221))
Example #3
0
 def test4(self):
     array = [-2, -9, -12, 3, 2, 1]
     self.assertEqual(1, iterative_quickselect(array, 3))
Example #4
0
 def test5(self):
     array = [-2, -9, -12, 3, 2, 1]
     self.assertEqual(-2, iterative_quickselect(array, 2))
Example #5
0
 def test2(self):
     array = [-2, -9, -12, 3, 2, 1]
     self.assertEqual(3, iterative_quickselect(array, 5))