Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
140 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,581
-3 votes
1 answer
133 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
1 vote
1 answer
98 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
1 vote
1 answer
150 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
-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
2 votes
2 answers
89 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
1 answer
34 views

I'm searching for a very flexible data structure being able to describe what data to fetch from an API ( assuming I would own that API by creating a custom wrapper plugin ). The data itself is quite ...
m477h145h3rm53n's user avatar
4 votes
2 answers
399 views

A lexicographical swap is defined as: At each step, pick the earliest possible inversion (i, j) (smallest i, then smallest j > i with a[i] > a[j]) and swap them. Repeat until the array is sorted....
ISG's user avatar
  • 49
2 votes
1 answer
201 views

An abstract data type maintains a subset of numbers {0,1,2,...,n-1}. The operations allowed on this are: insert(i) - Insert element i in the subset if not already present. find(i) - Return True iff ...
abora's user avatar
  • 1,101
4 votes
2 answers
272 views

I'm working on an interesting question about answering range h-index queries. Fyi h-index is the max integer h that an author has published at least h papers that each are cited at least h times. You ...
Isabella's user avatar
5 votes
1 answer
268 views

I was trying to check for wrap around property when the value is greater than the container that can hold it. public class Main { public static void main(String[] args) { double value = ...
shajid's user avatar
  • 53
0 votes
0 answers
63 views

In databases such as PostgreSQL, doing exact counts like select count (*) from table where condition perform a full table scan. PostgreSQL will need to scan either the entire table or the entirety of ...
user22476690's user avatar
0 votes
0 answers
32 views

In Python, we can use collections.deque to implement FIFO queue operations. For example: from collections import deque queue = deque([1, 2, 3]) print("Initial queue:", queue) # ...
douya huang's user avatar
0 votes
0 answers
74 views

In Rust, how can I define&manipulate objects that cannot be just copied bit-by-bit when they're moved? For example, an object that contains a relative pointer (i.e. a pointer whose target is ...
Stefan's user avatar
  • 28.8k
0 votes
2 answers
264 views

I have a use case requiring the reliable, durable storage, and efficient retrieval, of a large number of index entries (for which I've an application-specific serialization to bytes that preserves ...
aSteve's user avatar
  • 2,056
0 votes
0 answers
84 views

I'm trying to understand how an AVL tree is built from a sequence of integer keys. The keys I have are: 10, 20, 5, 4, 3, 2, 30, 40 I want to construct the AVL tree step by step and see how rotations ...
shakir Sumon's user avatar
1 vote
2 answers
183 views

I'm trying to understand how type information is stored in memory. We often say that an 8-bit value can store 2⁸ = 256 different values. But I'm wondering — when we create an object of that type, ...
toliveira's user avatar
  • 1,857
0 votes
0 answers
119 views

I tried my best implementing a Skip List in C++ in which I had a particular idea that I wanted to try out. Instead having every element in the base level be a column vector, I only only have a singly-...
Issac Howard's user avatar
2 votes
4 answers
185 views

I'm working on a problem where I need to maintain the median of a data stream, but unlike typical implementations that only support insertions, I also need to support deletions of arbitrary values. ...
Aditya Rawat's user avatar
-1 votes
1 answer
110 views

I would like to generate a minimum spanning tree for the following graph: I am using the disjoint set data structure and I am having trouble with the union (Union Rank) operation. The edges get ...
EngineerP's user avatar
1 vote
3 answers
113 views

I was watching a youtube video on doubly linked lists in C. One of the functions made for the doubly linked list was an "insert_after_node" function, which as the name suggests inserts a new ...
Samo's user avatar
  • 11
0 votes
0 answers
27 views

Are there any commonly used implementations of a restricted string (or string-like) type that sets constraints on the range of characters allowed at different positions? A simple example would be US ...
Osr Workshops's user avatar
0 votes
2 answers
92 views

If I have a list of values to insert into a new red-black tree, I could do an empty-tree initialization then do individual inserts. I wonder if I can take the list, sort it, then manually build the ...
CTMacUser's user avatar
  • 2,072
1 vote
1 answer
197 views

My Python code stores millions of ids in various data structures, in order to implement a classic algorithm. The run time is good, but the memory usage is awful. These ids are ints. I assume that ...
SRobertJames's user avatar
  • 9,367
2 votes
1 answer
103 views

I want to create a red-black tree that it is shared among different forked processes. Linking to an old question of mine old_question there cannot be resizable data structures in the shared memory (...
ALEXIS LAZANAS's user avatar

1
2 3 4 5
683