Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
60 views

How can I store `id`s in Python without paying the 28-byte-per-int price?

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,245
-1 votes
2 answers
79 views

C# - Efficiently Filtering a Large List of Objects Based on Multiple Complex Criteria [closed]

I have a large list of custom objects (List<MyObject>) in C#, potentially containing millions of items. I need to filter this list based on multiple criteria, some of which involve complex logic ...
Brick it's user avatar
1 vote
2 answers
168 views

How to build a nested adjacency list from an adjacency list and a hierarchy? [closed]

I have a simple adjacency list representation of a graph like this { 1: [2, 3, 4], 2: [5], 3: [6, 9], 4: [3], 5: [3], 6: [7, 8], 7: [], 8: [], 9: [] } which looks ...
Sachin Hosmani's user avatar
-7 votes
0 answers
62 views

fast look-ups/finds for coordinate systems [closed]

say a function takes a grid input of a vector<vector<int>> then we run a DFS or BFS search, based on the values in the grid. while doing a DFS/BFS, we need a container to hold the already-...
Husam Chekfa's user avatar
2 votes
0 answers
115 views

Implementing and Optimizing Unrolled Linked Lists in C++ for Benchmarking [closed]

I'm working on a project to benchmark the performance of various list implementations in C++ (e.g., std::list, std::vector, possibly others) against a custom implementation. I'm particularly ...
Athos's user avatar
  • 179
2 votes
1 answer
86 views

shared red black tree among processes

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
-3 votes
0 answers
37 views

Efficiently Reusing an ORM Model's Output Structure for Data from a Different Query (PHP ActiveRecord Example)

I'm working with a PHP framework that uses an ActiveRecord ORM (like Yii Framework or similar). I have a scenario where I need to query data from one or more tables (TableA, TableB) and present this ...
براء الصلاحي's user avatar
-1 votes
1 answer
107 views

Why do I only update the head pointer when deleting the first node in a singly-linked list, and can't use prev->next = head? [closed]

I'm implementing node deletion in a singly-linked list and ran into a conceptual problem regarding deleting the head (first node) of the list. I don't know why prev->next = head is not allowed? Isn'...
jamesnewbie's user avatar
1 vote
0 answers
79 views

How does Python represent slices in various cases?

Consider l = [1, 2, 3, 4, 5] print(l is l[:]) t = (1, 2, 3, 4, 5) print(t is t[:]) print(t[1:] is t[1:]) print('aa'[1:] is 'aa'[1:]) print('aaa'[1:] is 'aaa'[1:]) The result is, somewhat surprisingly,...
ByteEater's user avatar
  • 1,171
-2 votes
1 answer
63 views

Ask for information about the Bubble sort algorithm [closed]

I have a question about the analysis of the bubble sort algorithm. I created the bubble sort algorithm in Python without including temporary storage. That means it directly swaps the adjacent pairs. ...
mrpotter's user avatar
5 votes
1 answer
231 views

Optimizing LeetCode's "Minimum Pair Removal to Sort Array II" Solution to Prevent Time Limit Exceeded Errors

I am working on the LeetCode problem 3510. Minimum Pair Removal to Sort Array II: Given an array nums, perform the following operation any number of times: Select the adjacent pair with the minimum ...
manhera's user avatar
  • 59
2 votes
1 answer
124 views

Designing a Lock-Free Circular-Queue with CAS [Attempt: 2]

[Edit: Feel free to skip ahead to Attempt 2] I have been trying to write a lock-free circular queue (ring buffer) for a multi-producer, multi-consumer (MPMC) use-case. Now before the haters of wheel-...
sidsr003's user avatar
0 votes
1 answer
122 views

How to implement an AVL tree efficient enough in Haskell? [closed]

I am new in Haskell, and I try to implement an AVL tree. To test my code, I submit it to an Online Judge, which has a problem of balenced-tree. However, I get a MLE(Memory Limit Exceeded). In fact, ...
Haowen Shi's user avatar
0 votes
1 answer
106 views

Difference of two stack

Hello I have an implementation of stack class in C++ language by using a singly linked list. The code also contains operations such as constructor, destructor, pop, push, top, displaying the stacks ...
Berke Kale's user avatar
2 votes
1 answer
115 views

How to create set with values 1, 0, True, False along with other values in the same set

I am trying to create a set having different values along with True, False, 1, 0. I am aware that Python treats 1 as True and 0 as False. Imperatively, since the set keeps only the unique values, my ...
Venkata's user avatar
  • 311

15 30 50 per page
1
2 3 4 5
2275