All Questions
Tagged with performance data-structures
660
questions
7
votes
2
answers
116
views
Do Python coders have a bias towards list over tuple? [closed]
Basic Facts
Lists are mutable (supporting inserts, appending etc.), Tuples are not
Tuples are more memory efficient, and faster to iterate over
So it would seem their use-cases are clear. ...
0
votes
1
answer
55
views
Is there a name for this type of structured data, and what is a more efficient way to use it?
I'll try to make this question simple so that hopefully the concept is applicable to other fields.
I work with seismic datasets, where N earthquakes are recorded by M seismic stations. There is ...
0
votes
1
answer
66
views
Merge sort algorithm parallelization speed-up
I am doing a theoretical exercise for a class about a theoretical study of parallelizing the mergesort algorithm and the speed-up obtained for different amounts of cores.
I am using the following ...
1
vote
1
answer
86
views
How do I express the speedup of the merge sort algorithm when I parallelize the divide step?
I am trying to solve the following exercise:
Consider the following recursive mergesort algorithm (another classic divide and conquer algorithm). Mergesort was first described by John Von Neumann in ...
-1
votes
1
answer
72
views
Find words with only one letter difference from a list of words [closed]
I'm trying to find all the letters in a list that differ from each other by word. I then output them into an array. The trouble is it takes my current code 17 seconds for 18, 000 words and I trying to ...
-2
votes
1
answer
54
views
Queue from which first occurrences may be removed [closed]
I participated in an Amazon coding challenge, and one of the questions was a really simple one. To paraphrase:
Develop a method to handle shopping carts that takes two inputs, items being the current ...
1
vote
2
answers
66
views
Why I'm hitting time limit!? LeetCode Linked List Cycle (Solved but explanation needed!)
I'm working on solving LeetCode problem 141. Linked List Cycle:
Given head, the head of a linked list, determine if the linked list has a cycle in it.
There is a cycle in a linked list if there is ...
1
vote
2
answers
246
views
Counting Nested Ranges
With N ranges of the form [start, end] (both endpoints inclusive), I want to find, for each range, how many (other) ranges contain it and how many ranges it contains (are contained by it).
tl;dr count ...
0
votes
1
answer
120
views
How can I efficiently sort a large dataset in Python?
I'm working on a project where I need to sort a large dataset in Python efficiently. The dataset contains millions of records, and I'm currently using the built-in sorted() function. However, I'm ...
2
votes
1
answer
59
views
Can I further speed up query to find all objects within a range in python
Lets say I have a list of a simple dataclass like:
@dataclass
class Widget:
category: str
weight: int
I want to write a function that returns all widgets that equal a certain category and are ...
0
votes
0
answers
39
views
Optimizing Short Circuit Detection in Large Atom Cell: Seeking execution time improvement
Context:
I am working on a simulation problem involving an n x n matrix that represents atoms. Each atom can be either a conductor or not. The simulation involves transmuting non-conductive atoms into ...
0
votes
1
answer
42
views
How to structurally write different configurations of code for different number of variables
I am calibrating a bunch of parameters using any method (not important). But the number of parameters I choose to calibrate will be varied (anywhere from 1 to 4). If I wanted to calibrate 4 parameters,...
0
votes
0
answers
102
views
What is a more optimal algorithm for this problem?
Suppose you have an array A of N integers. In one round, you make changes as follows (based on the array snapshot at the beginning of the round):
-= 1 if greater than both adjacent (on both sides)
+= ...
-1
votes
2
answers
103
views
Get highest value in sublist fast
I have a list of numbers. The UI frequently checks the highest value in specific range of this list. For example the highest value between index 10000 and 12000.
The list is not sorted. The order of ...
-2
votes
2
answers
41
views
Which is more optimised making DISTINCT query in MySQL to get unique results or generate a set?
I am trying to fetch unique aocDetailIds in spring boot should I use distinct keyword(Code Block 1) or should I create a SET of strings(Code Block 2) , which will be more optimised ?
@Query(value = &...