Skip to main content
1 vote
1 answer
38 views

I’m studying red–black trees (CLRS style) and I’m confused about how black-height behaves during RB-INSERT-FIXUP. I quote here that procedure from CLRS: RB-INSERT-FIXUP(T, z) while z.p.color == ...
Sami Barakinston's user avatar
0 votes
1 answer
95 views

I'm working on a small DSA practice problem involving frequency counting, but with a twist. I have a list of tuples where each tuple represents a (category, item). Example: data = [ ("fruit&...
Ridit's user avatar
  • 21
Advice
0 votes
1 replies
39 views

I'm trying to model a generic "capability" or "permission" structure. The part I'm having trouble with is finding the name of the specific data structure. It's not a formal tree, ...
Jim Garrison's user avatar
0 votes
1 answer
206 views

I'm interesting in possible implementation approaches for a quite special variant of a list, with the following requirements: Efficient inverse lookup ("index of"): "give me an index ...
cubuspl42's user avatar
  • 8,601
0 votes
2 answers
153 views

I have a folder containing huge numbers of files in many subfolders, and I want to select the files with a name that matches any of a specified list of patterns (regular expressions). My regular ...
Theodor Zoulias's user avatar
-3 votes
1 answer
165 views

The algorithm I've written for an assignment is closely related to this monotonic stack approach https://www.geeksforgeeks.org/dsa/next-greater-element/ Best case: n pushes → Time complexity: O(n) ...
user29898's user avatar
Advice
1 vote
1 replies
38 views

I understand the standard explanation for why B-trees are used in databases: they minimize disk seeks by packing many keys into each node, keeping the tree shallow (3-4 levels), and enabling efficient ...
j.i.l.l's user avatar
  • 11
1 vote
1 answer
106 views

Problem summary: Each person in line has tickets[i] tickets to buy. Every second The person at the front buys one ticket. If they still need more tickets, they move to the end of the queue. We need ...
Hercules's user avatar
-2 votes
1 answer
36 views

Consider the following LeetCode problem: You are given an array nums of n positive integers and an integer k. Initially, you start with a score of 1. You have to maximize your score by applying the ...
Yousef Marey's user avatar
1 vote
1 answer
157 views

I have a JSON file with nested objects, and I want to update specific values inside it using Python. The structure can vary, but it usually looks something like this: { "user": { "...
JEFFERSON FRANCISCO ABAC LEMUS's user avatar
-4 votes
1 answer
62 views

📝 Body I have a Mongo collection CollectionA where each top-level object contains a nested array of meetings now each meetings have start and end times, for example: CollectionA = [ { &...
LEO_007's user avatar
  • 51
-1 votes
1 answer
133 views

I have two lists in Python: list1 = [1, 2, 3, 4] list2 = [3, 4, 5, 6] I want to merge them into a single list such that: No duplicates remain The original order of elements is preserved For the ...
Binil S Mathew's user avatar
1 vote
1 answer
53 views

I am learning about queue data structure in python. I learnt the implementation of a queue using list in python and the issue of memory wastage when we dequeue a few elements from the front. We use a ...
dataminer's user avatar
2 votes
2 answers
95 views

I’m trying to implement a mutual friends feature using a graph data structure represented as an adjacency list in Python. Each node represents a person, and each edge represents a friendship (an ...
Durga's user avatar
  • 21
1 vote
2 answers
101 views

The method below has been taken from the book Data Structures & Algorithms by Robert Lafore. This method is used to bubble sort a given array. nElems is the number of elements in the array. In my ...
Azer Shukurzade's user avatar

15 30 50 per page
1
2 3 4 5
2274