Filter
Exclude
Time range
-
Near
asked chatgpt to benchmark heap based vs batch quickselect: chatgpt.com/share/6a17e30d-7…
1
673
you can use k size batching and quickselect on arrays of size 2k, I'd bet it's faster than heap for plenty of k and n values. Context matters, **senior SWEs
1
1
166
Replying to @ChShersh @Dartrisen
Classic case of comparing apples to oranges. QuickSelect (O(n)) is great for large search engine shards dealing with static, batch arrays. But for an OS scheduler handling high frequency streaming tasks, a Min Heap is mandatory. Context matters, **senior SWEsπŸ˜…πŸ€£
2
2
432
Quickselect is fastest on average. O(N log K) heap solution is good for compiled languages. For others, accumulate > 2K elements, sort using the built-in, discard all but the first K, repeat. Still O(N log K), but the slow part is fast. All easy.
39
There are high IQ people who can’t implement a heap or quickselect under pressure though
2
324
Replying to @0xlelouch_
Use buckets: - Bucket each int by its top bits. Only the count per bucket matters, so 65K buckets fit in 512KB. - Cumulative counts find the bucket holding n/2. - Load that bucket in memory and quickselect inside it.
2
401
Replying to @RohOnChain
Some of the solutions need checking for sure. In the Citadel section, this misses the expected O(n klogk) quickselect solution (or just O(n) if the top-k don't need to be sorted) and the deterministic O(k klogn) heap solution.
1
159
The data structure has some similarities to QuickSelect and is pretty simple: repeatedly partition the list of values using random pivots until the smallest is left, and store each part in its own array. New elements are compared to the pivots and pushed to the right layer.
1
2
96
Apr 24
Replying to @javarevisited
Narrow the answer, not the data. Do a range-based binary search on values Pick a guess (mid), scan file, count how many ≀ mid Adjust range until you hit the median Or use external quickselect (partition in chunks on disk) Multiple passes, constant memory, no full sort.
311
The Distributional Tail of Worst-Case Quickselect Witold PΕ‚echa arxiv.org/abs/2604.13149 [πš–πšŠπšπš‘.π™Ώπš 𝚌𝚜.π™³πš‚]
5
6/8 Real example from yesterday - K Closest Points to Origin (LeetCode 973): πŸ“ I was stuck on the Quickselect optimal solution. I started with: "can you help me understand the optimal solution" Then: "explain quick select in this context" asked for a walk-through with a concrete example. Next: "show me with the code that is annotated with easy to understand variable names" I kept drilling in on the confusing parts: - "I dont understand moving the pivot to the end" - "what does this mean" (the write_position loop) - "but why do we move to the end of the array the random start point" - "can you do the example with numbers not points" (to simplify) Then I wrote my own code, it failed on edge cases, and I asked "intuitively why" it broke "what's the intuition with the left and right?" Took about 8-10 back-and-forths, but I actually understood Quickselect instead of just memorizing it.
1
12
Replying to @wintersre9uiem
That’s a bit redundant. He runs out of ammo BECAUSE he has both rifles. No grenades in his quickselect so he prolly isn’t using them. They clogging up his inventory along 14 large gunpowders
413
Using AI to fix code is like using quickselect in photoshop
4
Replying to @eeevgen
1. Correct 2. FWHT doesn't work with non-powers of 2 at all, some powers of two just fit the GPU thread heirarchy particularly nicely 3. Yeah quickselect is a right vibe. There are some clever ways to do it even faster if you don't need to know the logit of the sampled token
206
Replying to @fly_2_fake
ですです! γ‚γ‚ŠγŒγ¨γ†γ”γ–γ„γΎγ™γ€œοΌζ—©ι€ŸClaude Codeγ«γŠι‘˜γ„γ—γ¦γ„γ„ζ„Ÿγ˜γ«γ—γ¦γ‚‚γ‚‰γ£γ¦γΎγ™w QuickSelect(commit hashγ¨γ‹γ‚³γƒ”γƒΌγ§γγ‚‹γ‚„γ€οΌ‰γŒη΅ζ§‹γƒ™γƒ³γƒͺγƒΌγͺζ„Ÿγ˜γ§γ—γŸ
1
1
46
πŸš€ 100 Days of Code β€” Day 67 Solved: Kth Largest Element in an Array Used heap/quickselect techniques to efficiently find order statistics. Improving selection algorithm understanding. #100DaysOfCode #DSA #Heap #QuickSelect #Algorithms
1
10
2025 BMW i4 M60 G26 UK Version | DailyRevs Refreshed design with new headlights and optional Laserlight rear lights. BMW Operating System 8.5 with QuickSelect and Augmented View. #BMWi4 #i4 #G26 #DailyRevs #4series
124
| |── Graphs | β”œβ”€β”€ Graph Representation | | β”œβ”€β”€ Adjacency Matrix | | └── Adjacency List | β”œβ”€β”€ BFS | β”œβ”€β”€ DFS | β”œβ”€β”€ Topological Sort | β”œβ”€β”€ Cycle Detection | β”œβ”€β”€ Shortest Path | | β”œβ”€β”€ Dijkstra | | β”œβ”€β”€ Bellman-Ford | | └── Floyd-Warshall | β”œβ”€β”€ Minimum Spanning Tree | | β”œβ”€β”€ Kruskal | | └── Prim | β”œβ”€β”€ Disjoint Set (Union Find) | β”œβ”€β”€ Strongly Connected Components (Kosaraju, Tarjan) | β”œβ”€β”€ Bridges & Articulation Points | └── Network Flow (Ford-Fulkerson, Edmonds-Karp) | |── Greedy Algorithms | β”œβ”€β”€ Activity Selection | β”œβ”€β”€ Huffman Coding | β”œβ”€β”€ Fractional Knapsack | └── Job Scheduling | |── Dynamic Programming | β”œβ”€β”€ Memoization | β”œβ”€β”€ Tabulation | β”œβ”€β”€ 1D DP | β”œβ”€β”€ 2D DP | β”œβ”€β”€ Knapsack Variants | β”œβ”€β”€ Longest Common Subsequence | β”œβ”€β”€ Longest Increasing Subsequence | β”œβ”€β”€ Matrix Chain Multiplication | β”œβ”€β”€ DP on Trees | β”œβ”€β”€ DP on Graphs | └── Bitmask DP | |── Bit Manipulation | β”œβ”€β”€ Bitwise Operators | β”œβ”€β”€ Set / Clear / Toggle Bit | β”œβ”€β”€ Count Set Bits | β”œβ”€β”€ Power of Two | └── XOR Tricks | |── Advanced Data Structures | β”œβ”€β”€ Sparse Table | β”œβ”€β”€ Heavy Light Decomposition | β”œβ”€β”€ Treap | β”œβ”€β”€ Splay Tree | β”œβ”€β”€ Skip List | └── Order Statistic Tree | |── Advanced Algorithms | β”œβ”€β”€ Divide & Conquer | β”œβ”€β”€ Meet in the Middle | β”œβ”€β”€ Mo’s Algorithm | β”œβ”€β”€ Convex Hull | β”œβ”€β”€ K-th Smallest (QuickSelect) | └── Randomized Algorithms | |── Complexity Classes | β”œβ”€β”€ P | β”œβ”€β”€ NP | β”œβ”€β”€ NP-Complete | └── NP-Hard | |── Competitive Programming Concepts | β”œβ”€β”€ Fast I/O | β”œβ”€β”€ STL / Collections | β”œβ”€β”€ Precomputation | β”œβ”€β”€ Binary Lifting | └── Template Building | |── Interview Patterns | β”œβ”€β”€ Two Pointers | β”œβ”€β”€ Sliding Window | β”œβ”€β”€ Prefix Sum | β”œβ”€β”€ Binary Search on Answer | β”œβ”€β”€ Backtracking | β”œβ”€β”€ Greedy Choice | └── Dynamic Programming Pattern Recognition | |____________ END __________________
2
2
16
1,048
Day 16/28 β€” Coding Challenge πŸš€ Today I solved the Kth Largest Element in an Array problem without sorting (Optimal Approach). πŸ’‘ Learned: β€’ Heap vs Quickselect approach β€’ Time complexity optimization (O(n)) #28DaysOfCode #DSA #CodingJourney #Java #ProblemSolving #100DaysOfCode
8