Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

search a number in 2d sorted

def find_in_sorted_mat(mat, N,M,find_element):
    for k in range(len(find_element)):
        X = find_element[k]
        notFound = True
        R = M-1
        L = 0
        while L>-1 and R>-1 and L<N and R<M:
            if mat[L][R] == X:
                print(L,R)
                notFound = False
                break
            elif mat[L][R]>X:
                R = R-1
            else:
                L = L+1
        if notFound:
            print(-1)
Comment

PREVIOUS NEXT
Code Example
Python :: custom port odoo 
Python :: auto reload exml odoo 13 
Python :: Set symmetric Using the Symmetric Difference Operator (^) Method 
Python :: aws chalice 
Python :: Find Factors of a Number using While Loop with validation 
Python :: matplotlib insert small subplot into subplot 
Python :: Using python permutations function on a list with extra function 
Python :: Math Module asin() Function in python 
Python :: extract tables from image python 
Python :: faceModel = "opencv_face_detector_uint8.pb" 
Python :: Using **kwargs to pass the variable keyword arguments to the function 
Python :: basic kivy md 
Python :: 0xff in python 
Python :: Getting TimeZone from lat long coordinate 
Python :: install python 3.10 pip 
Python :: grab element based on text from html page in python 
Python :: Python NumPy atleast_1d Function Example when inputs are in high dimension 
Python :: display colors in python console 
Python :: how to convrete .npz file to txt file in python 
Python :: Python NumPy hstack Function Example with 2d array 
Python :: Python NumPy repeat Function Example Working with 1D array 
Python :: pandas dt.weekday to string 
Python :: NumPy rot90 Syntax 
Python :: visualize 3 columns of pandas 
Python :: miniforge cv2 vscode 
Python :: pandas cleaning dataframe regex 
Python :: Accessing range() with index value 
Python :: python tkinter.ttk combobox down event on mouseclick 
Python :: create multiple marks python for python 
Python :: how to end if else statement in python 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =