algorithms

Towards Data Science
DEV Community

The Quest Begins (The “Why”) Picture this: I’m huddled over my laptop at 2 a.m., eyes glazed, watching the metrics dashboard flash red like the Death Star’s super‑laser charging up. Our API is getting hammered by a burst of traffic from a misbehaving mobile client, and every request is punching straight through to the database. The DB starts to groan, latency spikes, and suddenly we’re serving 50…

algorithmscomputer-science
Lifeboat News: The Blog
Cecile G. Tamura
12h ago

His revolutionary idea? Before “computer science” was even a field, Church invented the lambda calculus (λ-calculus)—an elegant, abstract system for expressing computation through pure mathematical functions. In 1936, he used it to prove that no universal algorithm could ever decide the truth of all mathematical statements, solving Hilbert’s famous Entscheidungsproblem in the negative. This becam…

algorithmscomputer-sciencemathematical-physicsmathematics
Computer Science on Cambridge Core

(read ‘setlog’) was born as a Constraint Logic Programming (CLP) language where sets and binary relations are first-class citizens, thus fostering set programming. Internally, is a constraint satisfiability solver implementing decision procedures for several fragments of set theory. Hence, can be used as a declarative, set, logic programming language and as an automated theorem prover for set the…

algorithmscomputer-science
DEV Community

When building high-concurrency backend services, two ecosystems dominate the conversation: Node.js and Go (Golang). If you ask the internet how they handle concurrency, you’ll get the standard textbook answers: "Node.js is asynchronous and single-threaded, using an Event Loop." "Go is synchronous and multi-threaded, using lightweight Goroutines." But what do these statements actually mean under t…

algorithmscomputer-science
DEV Community

I had a write that spanned two physically separate databases. A rename that had to propagate across several tables in one database and a couple of tables in another, and the two had to stay consistent. No distributed transaction coordinator was available to me. So I did the obvious thing: opened a transaction on each, did the work, and committed them one after the other inside a try/catch with ro…

algorithmscomputer-science
Towards Data Science
Scientific Reports
DEV Community

Every time you tap "Book Ride," a system makes dozens of decisions in under two seconds: Which driver? What route? What's the real ETA? This article breaks down exactly how the dispatch algorithm works — from the greedy approach that fails at scale, to the bipartite graphs, batched matching, and surge pricing mechanics that power Uber, Lyft, Grab, and Gojek today. Why a Greedy Dispatch Algorithm …

algorithmscomputer-science
DEV Community

The Quest Begins (The "Why") Ever had one of those days where your API feels like it’s stuck in quicksand? I was building a simple rate‑limiter for a microservice that throttles requests per IP address. The idea was straightforward: every incoming hit checks a counter stored in Postgres, increments it, and if the counter exceeds the limit we return 429. At first it worked like a charm on my lapto…

algorithmscomputer-scienceprogramming-languages
DEV Community

Introduction: The Timeless Nature of Algorithms When you crack open a standard Data Structures and Algorithms textbook, it’s easy to assume the contents are products of the digital age. But here’s the kicker: many of these algorithms were devised centuries before computers existed . Take the Euclidean algorithm for finding the greatest common divisor—it dates back to 300 BCE . Or the sieve of Era…

algorithmscomputer-sciencemathematical-physics
DEV Community
Jaspreet singh
1d ago

Problem Statement Given a binary array nums , return the maximum number of consecutive 1's present in the array. Example Input: nums = [1,1,0,1,1,1] Output: 3 Explanation: The longest sequence of consecutive 1's is [1,1,1] Length = 3 Brute Force Intuition (Interview Explanation) For every index, if the element is 1 , start moving forward and count how many consecutive 1's exist. Keep updating the…

algorithmsmathematics
DEV Community

Problem Statement Given a sorted integer array nums , remove the duplicates in-place such that each unique element appears only once. Return the number of unique elements k . The first k elements of the array should contain the unique elements in their original order. Example Input: nums = [1,1,2] Output: 2 Modified Array: [1,2,_] Brute Force Intuition (Interview Explanation) One straightforward …

algorithmsmathematics
DEV Community

The Quest Begins (The “Why”) I still remember the first time I stared at a whiteboard interview question that asked for the shortest number of moves a knight needs to reach a target square on a chessboard. My brain went into panic mode: “Do I try every possible path? Do I keep a visited set? Do I… recurse?” I felt like Neo in The Matrix before he sees the code—everything was a blur of green symbo…

algorithmscomputer-sciencegraph-theory
DEV Community

Weekly Challenge 377 Each week Mohammad S. Anwar sends out The Weekly Challenge , a chance for all of us to come up with solutions to two weekly tasks. My solutions are written in Python first, and then converted to Perl. Unless otherwise stated, Copilot (and other AI tools) have NOT been used to generate the solution. It's a great way for us all to practice some coding. Challenge , My solutions …

algorithmscomputer-scienceprogramming-languages
DEV Community

I Built a Consistent Hashing Ring in Pure Python and Finally Understood How Cassandra Distributes Data I've been using Cassandra and Redis Cluster for years. I knew consistent hashing was "how they work." But I never truly got it until I built one myself from scratch, in pure Python, with zero dependencies. This post is about what I learned doing that. The Problem Consistent Hashing Solves Imagin…

algorithmscomputer-science
DEV Community

Some API requests can't finish in time for a single HTTP response. Generating a report, transcoding a video, running a batch import — these take seconds or minutes, far longer than any client should hold a connection open for. If you try to do this work inside a normal request, you'll hit gateway timeouts, frustrated clients retrying half-finished jobs, and load balancers killing connections at 3…

algorithmscomputer-science
DEV Community

The Problem: Finding a Needle in a Haystack Answer-first: Uber and Grab find the nearest available driver in under 100ms by dividing the Earth's surface into hexagonal cells (H3 index at Resolution 8, each ~0.74 km²). Instead of calculating distance to every driver, they look up only the 7 cells nearest to the rider — reducing millions of comparisons to dozens. When you tap "Book" on Grab, the sy…

algorithmscomputer-science
DEV Community

Problem Description: Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to the target. You may assume that each input would have exactly one solution, and you may not use the same element twice. Link to the problem Solution: class Solution { public int [] twoSum ( int [] nums , int target ) { //map to store visited numbers along with the…

algorithmscomputer-science
Hacker News

In 1980, Intel released the Intel 8087 floating-point coprocessor, a chip that could make math up to 100 times faster. As well as arithmetic and square roots, the 8087 computed transcendental functions including tangent, exponentiation, and logarithms. But it all depended on a 69-bit adder: "The arithmetic heart of the floating-point execution unit is centered about a nanomachine comprised of the…

algorithmscomputer-science
research.ioresearch.io

Sign up to keep scrolling

Create your feed subscriptions, save articles, keep scrolling.

Already have an account?