mirror of
				https://github.com/pocketpy/pocketpy
				synced 2025-10-26 22:40:17 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			664 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			664 B
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| ---
 | |
| icon: package
 | |
| label: bisect
 | |
| ---
 | |
| 
 | |
| ### `bisect.bisect_left(a, x)`
 | |
| 
 | |
| Return the index where to insert item `x` in list `a`, assuming `a` is sorted.
 | |
| 
 | |
| ### `bisect.bisect_right(a, x)`
 | |
| 
 | |
| Return the index where to insert item `x` in list `a`, assuming `a` is sorted.
 | |
| 
 | |
| ### `bisect.insort_left(a, x)`
 | |
| 
 | |
| Insert item `x` in list `a`, and keep it sorted assuming `a` is sorted.
 | |
| 
 | |
| If x is already in a, insert it to the left of the leftmost x.
 | |
| 
 | |
| ### `bisect.insort_right(a, x)`
 | |
| 
 | |
| Insert item `x` in list `a`, and keep it sorted assuming `a` is sorted.
 | |
| 
 | |
| If x is already in a, insert it to the right of the rightmost x.
 | |
| 
 | |
| #### Source code
 | |
| 
 | |
| :::code source="../../python/bisect.py" ::: |