Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT]: Add a binary search script #106

Closed
coxmars opened this issue Jan 22, 2025 · 13 comments · Fixed by #121
Closed

[FEAT]: Add a binary search script #106

coxmars opened this issue Jan 22, 2025 · 13 comments · Fixed by #121
Assignees
Labels
cairo-scripts difficult: medium enhancement New feature or request ODBoost This issue will be available ONLY during the ODBoost

Comments

@coxmars
Copy link
Contributor

coxmars commented Jan 22, 2025

📘 Description

We need to implement a binary search algorithm for efficient searching in sorted arrays. Binary search is a fundamental searching algorithm that repeatedly divides the search interval in half, providing logarithmic time complexity. This implementation will be part of our searching utilities package and should be optimized for performance while maintaining readability.

✅ Acceptance Criteria

Create a function that implements binary search with:

  • Input: sorted array and target value
  • Output: index of target element or appropriate indicator if not found
  • Handle edge cases properly (empty arrays, non-found elements)
  • Implement comprehensive error handling

🌎 References

📜 Additional Notes

  • Do not apply until the ODBoost begins.
  • Read our contribution guidelines before applying.
@coxmars coxmars added cairo-scripts difficult: medium enhancement New feature or request ODBoost This issue will be available ONLY during the ODBoost labels Jan 22, 2025
@NueloSE
Copy link
Contributor

NueloSE commented Jan 22, 2025

A frontend developer with experiences using JavaScript and modern frameworks for creating seamless and interactive user experience. Am also experienced with developing and deploying smart contracts, as well as writing tests to ensure functionality.
my pseudo approach to solving the above problem would involve:
Initialize two pointers for the search interval:
left = start of array (0)
right = end of array (length - 1)
While left pointer is less than or equal to right:
Calculate middle point: mid = (left + right) / 2
Compare target with middle element
If target is found at mid, return the index
If target is greater, search right half (left = mid + 1)
If target is smaller, search left half (right = mid - 1)

@Bosun-Josh121
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged:

software engineering background, backend & smart contract dev with contribution to similar tasks(https://app.onlydust.com/u/Bosun-Josh121) looking to make first contribution on this project

How I plan on tackling this issue

with great familiarity with this data structure & cairo, i'm confident in tackling this,

work on feedback & recommendation ensuring contact. Can deliver within a day upon assignment

@GideonBature
Copy link
Contributor

Could I take over this issue?

I am a software engineer with working knowledge of Cairo and also have an understanding of Data Structures and Algorithm (in C, Python and JavaScript) I believe will also be applicable here . I will send my first PR in 48 hours.

@SoarinSkySagar
Copy link
Contributor

may i take up this issue @coxmars?

background: cairo dev with 5 months of experience and regular contributor at @keep-starknet-strange

eta: 2 days

@Nityam573
Copy link

Can I get assigned to this task @coxmars
I am proficient in cairo projects
View my Profile:
https://app.onlydust.com/u/Nityam573

@armaanansari121
Copy link
Contributor

armaanansari121 commented Jan 22, 2025

May I take this up? I've been a Competitive Programmer, I'm specialist at codeforces and I'm also good at cairo. So this would be perfect issue for me.

ETA: 24 hrs

@Jagadeeshftw
Copy link
Contributor

Proposal to Work on the Issue

I would be delighted to contribute to this issue, as I have extensive experience with Cairo programming and developing decentralized applications on StarkNet.

Estimated Timeline

I anticipate delivering a working solution within the next 24 hours. Please let me know if I can proceed.

Looking forward to contributing and collaborating!

Best regards,
Jagadeesh B

@mariocodecr
Copy link

Hii! My name is Mario Araya, I’m a Software Developer with 2+ years of experience. I have worked with backend technologies such as Cairo, Java, and C#, as well as frontend development using React, NextJS, and JavaScript/TypeScript. I’ve made contributions to open-source projects, completed a Starknet Bootcamp, exercises on NodeGuardians, finished Starklings, and participated in multiple hackathons. I’m also a member of the Dojo Coding community here in Costa Rica.

I will implement a binary search function optimized for performance and readability. The function will take a sorted array and a target value as inputs and will return the index of the target element if found or an appropriate indicator (e.g., -1 or null) if not found. I will handle edge cases such as empty arrays and non-found elements. The function will include comprehensive error handling to ensure robustness, checking for invalid input types (e.g., non-array inputs or non-number targets). Additionally, I will ensure the implementation adheres to the performance requirements, achieving logarithmic time complexity (O(log n)). After completing the function, I will test it with various edge cases to ensure its correctness.

@Michaelkingsdev
Copy link

Can I attempt this issue?

@Benjtalkshow
Copy link
Contributor

I'd like to take this issue.

@RomThpt
Copy link
Contributor

RomThpt commented Jan 22, 2025

I’d love to work on this task and contribute to the project. I’ll be participating in the ETHDenver hackathon, and I see this as a great opportunity not only to help improve the project but also to grow my skills by tackling this issue.

@ShantelPeters
Copy link
Contributor

I’d like to work on this.

@Wendyalbert
Copy link

Can I take care of this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cairo-scripts difficult: medium enhancement New feature or request ODBoost This issue will be available ONLY during the ODBoost
Projects
None yet
Development

Successfully merging a pull request may close this issue.