Code Monkey home page Code Monkey logo

binarysearchdemo's Introduction

Binary Search Demo

This Python script demonstrates the versatile application of binary search in various scenarios:

1. Finding the Square Root

  • The script includes a function (mySqrt) that utilizes binary search to find the square root of a given number.

2. Finding First and Last Occurrence in a Sorted Array

  • Another function (find_first_last_occurrence) employs binary search to find the first and last occurrence of a target element in a sorted array.

3. Searching in a 2D Matrix

  • A function (search_in_2d_matrix) applies binary search to determine whether a target value is present in a 2D matrix where each row and each column is sorted.

4. Finding the Peak Element in an Array

  • The script finds the peak element in an array using binary search.

Python

Languages and Tools

python

Requirements

Just Python 3.6.9

Test Coverage

TODO

License

This project is licensed under the MIT License - see the LICENSE.md file for details


Connect with me

francescopaololezza francescopaololezza

binarysearchdemo's People

Contributors

francescopaolol avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.