/r/datastructures
What's better than one data structure? Two data structures.
Let's discuss the latest hip and fashionable data structures and conjectures about them:
cache trees, skip-splay trees, the world is our data oyster.
/r/datastructures
Under the hood as a fresh software developer should I deeply know how the time complexity computations work mathematically? bc I'm studying algorithms-I by robert sedjweck and till module 3 now he is talking about Mathematical models and observations for algorithms
Does anyone know playlist on hash tables.i strugging with these.thank you
Just took the basics of programming in c++ , i will learn data structure in this semester any recommendations or playlist which explain it simply and giving all details it will be amazing if he explains it while developing a game from scratch, thanks feel free to leave a comment or give an advice 🫶
I’m thinking of buying Neetcode premium subscription for a year, is it worth buying? please reply me need to start grinding dsa as quick as possible
When I took DSA, the professor said it was better to build your own hash table instead of using a library and that it would make your programs better but never explained why. Is this true? Why would that be the case?
I’m working on a problem where I need to compare multiple lineages (family trees) to check if they are structurally identical. Each lineage starts from a single root (ancestor) and extends downwards. The trees are ordered by the age of the children, and each node has a gender indicator (I, M, K for intersex, male, female, respectively).
The trees are considered structurally equal if:
Here's an image that shows when two trees are not structurally equal.
The problem requires an algorithm with a time complexity of O(n * m), where n is the number of lineages, and m is the number of nodes in the largest tree. We're given that a parent can't have more than 12 children. We're required to use decomposition in our algorithm.
I’ve considered using BFS for tree traversal, as it processes nodes level by level, which fits well with comparing ordered children. I would also use a tree data structure to represent each lineage, where each node contains the gender and references to its children.
However, I’m not entirely sure if this approach is sufficient to meet the problem's requirements, especially given the constraints around ordering and early termination if the structures are not identical.
So to my question: Would using BFS combined with a tree data structure be sufficient to compare these trees in terms of both time complexity and structure? How does BFS start without a common root? Wouldn't that imply a common ancestor and be incorrect for this type of comparison?
I am CS Student who is interested about Data Engineering, so i skipped DSA my first 2 years at UNI thinking that only SWE need that. Now i Want get back on the race and get better at solving leetcode problems yet unfortunately, there is a concept that keeps me frozen, it's recursion, I just can't write recursion code to solve backtracking problems, I know the concepts and most of the times i look at a problem, I know the exact approach or algorithm yet i struggle at implementing this recursion thing. (i couldn't even solve the all combination of an integer array problem).
Hey everyone,
I've been trying to work on Leetcode, but I feel like I'm constantly copying solutions instead of solving the problems on my own. I've completed around 55 questions so far, but for most of them, I had to check the solutions to even make progress. This is really making me feel bad about myself because I know this approach won’t help in the long run.
It feels like every problem is completely different, and I’m struggling to apply the concepts I’ve learned. Has anyone else been through this? How did you overcome this hurdle and start solving problems on your own? Any advice or resources that could help me build problem-solving skills would be really appreciated!Thanks for your help in advance.
#Leetcode #CodingHelp #ProgrammingAdvice #StrugglingToLearn #CodingJourney
I'm in my 5th semester I studied data structures in my 2nd sem. I know the theory but I couldn't code. If you guys used any road map for this please help me.i really don't know where to start
I entered my first lecture last week and i literally couldn't understand anything like i understand what the professor saying but i just don't understand what is this about or what is the whole goal of it can someone help me out study this subject please Thank you
I entered my first lecture last week and i literally couldn’t understand anything like i understand what the professor saying but i just don’t understand what is this about or what is the whole goal of it can someone help me out study this subject please Thank you 💗
Hi, sorry a basic question, as title. I have searched internet and asked ChatGPT, and cannot get a coherent answer to this question. My understanding is that I need a poiner for the dynamic array. Here is my attempt: (I have already implemented all functions of linked list from scratch, but struggled with getting started with this one) Thank you again for your kind help!! Question: dynamic array is always better than static array due to memory allocation, right?
class DynamicArray:
def __init__(self):
self.array = []
self.next = 0 # a pointer
def size(self): # number of items
array = self.array
while array is not None: # array not empty
self.next += 1
Implementation 1
n = len(my_array)
for i in range(n-1):
for j in range(n-i-1):
if my_array[j] > my_array[j+1]:
my_array[j], my_array[j+1] = my_array[j+1], my_array[j]
Implementation 2
for i in range(len(array)-1,0,-1):
for j in range(i):
if (array[j] > array[j+1]):
temp = array[j]
array[j] = array[j+1]
array[j+1] = temp
Somebody guide me for leaning DSA in programming
Why am I not getting better in data structures man people who are around me who didn't even understand them are getting ahead Why am I not able to build logic why am I not able to code Man I'm so tired I'm so jealous and sacred this exam could've landed me a good internship
comeover to discord we will catch up and plan what next
Hello, I'm looking for videos that help me understand how to calculate tc and sc. Like solving them (I know what tc and sc are, it is difficult for me to calculate them tho)
Any advice is helpful
Hi everyone,
I'm preparing for software engineering roles at big product-based companies, and I have a bit of a dilemma. I’ve been working with JavaScript (and TypeScript) for the past 4-5 years, so I’m very comfortable with it, especially when it comes to coding challenges and problem-solving. However, I’ve heard that using Go (Golang) in interviews could create a good impression, especially for backend or systems roles.
I’m willing to put in the extra effort to learn Go if it helps me stand out in interviews, but I’m not sure if it’s the best strategy considering I’m already strong in JS/TS. I’ll need to spend time learning Go's syntax and nuances, but if it’s worth it for my career growth and interview performance, I’m ready for the challenge.
For those who have been through similar situations, what would you recommend? Should I stick with what I know (JS/TS), or should I invest time in learning Go for the potential advantage it might give in interviews? I'd love to hear your thoughts, especially if you’ve faced a similar decision!
Thanks!