|
|
|
Ask HN: Does anyone actually use data structures/algorithms at work?
|
|
6 points
by rbnsl
812 days ago
|
|
Sitting at around 4 years of experience now and last month was my first time actually implementing a graph traversal in prod, and then last week a skip list. It was fun, and I loved being able to instantly link the problems I was facing to algo/structures I knew would work, but it seems it happens so infrequently to not justify the emphasis we place on these in interviews. I imagine any regular SWE at <insert-product-focused-company> just ends up using libraries that themselves implement all the data structure/algo pieces, leaving you with just abstractions. Anyone here regularly using/thinking about these? And I don’t just mean small things like when to use an array vs a map but the more complex stuff |
|
So my solution was to turn each phase’s graph into a binary tree by converting the n-tree to a b-tree where each node has a parent, a child, and a sibling to make traversal easy. Then I gathered all of the nodes into a single ordered array of structs and used array indices to reference parent, child, sibling for each phase.
To trace up, you selecting the starting node and the phase and it would walk up the graph to a source or you could specify a source node and transverse down by phases to create a downstream trace showing all affected customers.
Each node also had protective devices, like fuses and switches, that could be activated/deactivated or predicted as sources of outages.
At the time, I could downstream trace to every customer of a substation in a second or less when most GIS based network traces took 10-15 seconds sometimes. Upstream traces were almost instantaneous. Plus, our customers often converted CAD to GIS and the lines lacked spatial connectivity without a lot of cleanup, but my trace engine could handle disconnected lines and devices that weren’t spatially connected by using attributes.
It was the biggest use of my data structures and algorithms knowledge that I’ve used and it was good enough for a software patent.