Questions tagged [data-structures]
A data structure is a way of organizing data in a fashion that allows particular properties of that data to be queried and/or updated efficiently.
data-structures
34,007
questions
-1
votes
0
answers
23
views
Java add method is not working during arraylist iteration [duplicate]
Add method is not working in Iteration of arraylist but remove method is working in iteration of arraylist.
package thread;
import java.util.ArrayList;
import java.util.Iterator;
import java.util....
0
votes
1
answer
28
views
Performance Comparison Between Tabulation and Memoization for Dynamic Programming [closed]
I'm delving into dynamic programming and trying to understand the general performance differences between tabulation and memoization. Both techniques aim to optimize recursive algorithms by storing ...
1
vote
0
answers
34
views
Reading and grouping files from a directory in Zig
I have a folder of images that contains several thousand images in 3 different formats: png, jpg and webp. For instance: boat.png, boat.webp, plane.jpg, plane.png, plane.webp.
I decided to learn Zig ...
0
votes
2
answers
35
views
Implementing a Stack in Python: Problem with the POP function
I'm trying to implement the Stack Data Structure in Python from scratch. Unfortunately, I have a problem with the pop functionality.
The pop function should delete the top element of the stack. ...
0
votes
0
answers
38
views
Efficient data structure for matching items in two lists of data -python
I have two lists where one list is filled with ID's and the other list is filled with process names. Multiple process names can share an ID.
I want to be able to create a data structure where I can ...
-1
votes
1
answer
47
views
The best data-model to store nested tags? [duplicate]
I'm trying to make a breadcrumb for a ecommerce website. Something like this:
Home > Kitchen > Serving and reception > Spoon
Each of those item are a tag. So, the tags table is parent-based/...
0
votes
0
answers
11
views
last submission cannot be restored as the driver code has been updated GeeksForGeeks
As you can see its showing last submission cannot be restored as the driver code has been updated
Issue: Unable to Retrieve Previous Submissions on Geeks for Geeks
I have been practicing Data ...
0
votes
2
answers
84
views
How to binary search a std::vector BUT that return a RandomAccessIterator?
I'm looking for a log2(N) way of searching a std::vector and receive a RandomAccessIterator. I want it to work exactly as std::lower_bound() but return a RandomAccessIterator instead of a ...
2
votes
2
answers
57
views
Finding the subarray with the least median given a size K and an array of length N
I have been struggling the past month with this problem that was given to us on our course while I was upsolving it. The task is to find the window of size K with the least median in an array of ...
0
votes
0
answers
62
views
How can I have a better implementation of an unknown tree I wrote myself? [closed]
I am converting a X509 certificate management code from C++ to C, but C lacks many features that C++ has. So I wrote a data structure myself. Is there a similar data structure implemented in the ...
0
votes
1
answer
46
views
Design a Data Structure for Efficient Key-Value Operations with Top K Check in c++
Data Structure Requirements
Design a data structure that supports the following operations:
Insertion: Insert a key-value pair.
Deletion: Delete a key-value pair.
Check Top K: Given an integer k and ...
1
vote
1
answer
96
views
Mergesort for singly-linked lists gives correct results but leaks memory
I'm working on an assignment to implement mergesort for singly-linked lists in C++. The merge function needs to merge two sorted lists in-place without creating new nodes. The mergesort function ...
0
votes
3
answers
104
views
Unordered map not updating
I was cloning a graph (deep copy) and the only problem in my code is in the BFS() function inside the if statement, when I'm updating the visited hashmap, it's not updating.
Node* cloneGraph(Node* ...
-1
votes
0
answers
30
views
How to remember DSA concepts [closed]
I have started DSA last month and when I revisit those questions now I get completely blank. Even the easiest sorting algorithms seems as if I'm doing them for the first time.
A strategy to remember ...
1
vote
1
answer
53
views
Where to store display data in a C Project
I am writing a C-Program for an Esp32, to display some Images on a 8x32 LED-Matrix.
I struggle to store the Image Data in a way, that different .cpp files have access to it, but it won't lead to ...