SShortSingh.
Back to feed

Binary vs. jump search: the target determines which probes less

0
·3 views

The article asks why jump search can read fewer array values than binary search despite binary search's O(log n) worst case. Comparing searches for 2 and 46 in a sorted array of 32 even numbers shows the winner depends on the target. For 2, jump search needs only two reads while binary search needs five. For 46, binary search needs five reads while jump search needs eight. The author provides JavaScript traces that record each array read and whether the target was found. The piece also notes that jump search's worst case is O(√n) and that these results count reads rather than measuring elapsed time.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingHacker News ·

Essay Calls for Capable People Who Care to Engage With Society's Problems

A blog essay titled "We Need Smart People Who Give a Shit" was posted on Hacker News, drawing 84 points and 23 comments. The post, published on violetpixel.com, argues that society needs talented individuals to commit themselves to pressing problems. The article text available to us is limited to metadata, so its specific arguments and examples cannot be confirmed. Discussion on Hacker News has been moderate, reflecting interest among the platform's readership.

0
ProgrammingHacker News ·

Ruby Patches Multiple Vulnerabilities in Regexp and String Case Conversion

The Ruby project has published a security advisory describing several vulnerabilities affecting its Regexp and String case conversion functionality. The announcement was posted on the official Ruby website on November 18, 2026. The provided source material includes only the advisory link and community discussion metadata, so the specific technical details of each flaw are not available here. Developers running affected Ruby versions are directed to the advisory for remediation guidance. Readers should consult the original advisory for complete information on impact and fixed versions.

0
ProgrammingHacker News ·

Software Companies Accused of Undermining Home Computing, Per Blog Post

A LiveJournal blog post argues that software companies are working to erode home computing. The article was shared on Hacker News, where it received 16 points and 2 comments. The provided source text contains only links and engagement metrics, without the full argument or specific examples. As a result, the specific companies, products, and claims behind the criticism cannot be confirmed from the available material.

0
ProgrammingDEV Community ·

AWS Budgets vs Cost Explorer: Choosing the Right Tool for Cloud Spend

AWS Budgets is a proactive tool that monitors actual and forecasted spending and can trigger alerts or automated actions before costs grow too high. AWS Cost Explorer, by contrast, is a retrospective analytics tool that shows which services drove historical spending. The article recommends that homelab and personal AWS users configure both, using Budgets to cap spending and Cost Explorer to find the cause of unexpected charges. Budgets without actions are free, and Budget Actions can apply IAM deny policies, attach Service Control Policies, or stop EC2 and RDS resources when thresholds are breached. A key limitation is that Budgets data refreshes only up to three times daily, so spikes between updates can exceed a limit before any action fires.