Clojure Diary · @clojurediary
0 followers · 1 posts · Server clj.social

You can't convert list of lists to a map in Clojure

youtu.be/k5A25Hk_ebY

#clojure #programming #datastructures

Last updated 2 years ago

Karthikeyan A K · @mindaslab
77 followers · 870 posts · Server mstdn.social

You can't convert list of lists to a map in Clojure

youtu.be/k5A25Hk_ebY

#datastructures #Programming #clojure

Last updated 2 years ago

Raccoon at TechHub :mastodon: · @Raccoon
114 followers · 897 posts · Server techhub.social

Randomly thinking about when the size if a in a , though I guess it could be used for any in .

If you know how big the largest number you're going to have to keep track of is, you can cut down on the size of the integer by choosing a number of bits that's just big enough to fit that... But there are ways you can get really screwy with this.

For example, you could choose a number that isn't the standard 8, 16, 32, 64 by going above that and using the extra bits as flags or something, like making it 24-bit and using the last 8 bits as another byte. Or you could lower the granularity, and multiply the value of whatever the number is to get bigger numbers at the expense of numbers not divisible by that.

The issue with thinking of this however is that we are talking a handful of bytes in what could be megabytes, so less than 0.1% of the byte size...

(more)

#bikeshedding #programming #filesize #integer #fileformat #datastructures #computerscience

Last updated 2 years ago

Naresh · @naresh
5 followers · 26 posts · Server social.tchncs.de

Started reading the book. My first formal introduction to and !

#clrs #algorithms #datastructures

Last updated 2 years ago

πŸ’‰Eliot B · @bigblen
229 followers · 1657 posts · Server mastodon.nzoss.nz

In today's illustrated, we have FIFO queue with block allocated storage

#datastructures #egg

Last updated 2 years ago

amen zwa, esq. · @AmenZwa
125 followers · 1354 posts · Server mathstodon.xyz

I just published "PDF: purely functional data structures in " on GitHub.

These are Elm reimplementations of the data structures presented in the book " " (1999) by Prof. Okasaki. It is the only one of its kid that I am aware. It is a tour de force of functional thinking. The book includes and implementations.

Okasaki is a descendant of the ML tradition. His PhD advisor at CMU during the mid 1990s was Prof. Harper who wrote "Programming in Standard ML" (2011), contributed to the definition of the language, and was a member of the ML posse, alongside Milner, Tofte, Reppy, MacQueen, et al.

I chose for the following reasons:

β€’ Elm is a purely functional language
β€’ Elm does not yet have a comprehensive library of data structures
β€’ Elm evolves at a deliberate pace, with subsuming to the modern CI/CD pipeline pressure
β€’ Elm is one of the simplest languages
β€’ Elm is sane
β€’ These properties make Elm a good candidate for use in education, for teaching FP, for teaching data structures, and for teaching disciplined web programming, and a comprehensive collection of data structures could be of use in undergraduate education

An unstated, but no less important, reason for my choosing Elm is Python fatigue. I currently use Python at work, and I am also expanding my "CLRS algorithms in Jupyter notebooks" project. I like Python, but many hours of Python a day is deleterious to my . Elm is both the prophylactic and the cure.

Please note that both PDF and CLRS are my solo projects, and they are works in progress that grow incrementally. Both projects aim to help undergraduate students.

github.com/amenzwa/pfd

#mentalhealth #cs #fp #haskell #standardml #datastructures #functional #purely #elm

Last updated 2 years ago

stark@techhub:~$ β–ˆ · @Stark9837
471 followers · 2424 posts · Server techhub.social

@sidereal

I used it when I was busy with my course. All of the software has advanced debugging tools.

So I used for , for C++ and for . It allowed me to debug connections and relationships in data structures.

Today, I wouldn't personally use it because I know those stuff now, and I have my own workflow now. I never step through code anymore, I don't even use the debugging in anymore.

When required, I am a degenerate "console.log" debugger.

@Python

#datastructures #jetbrains #pycharm #python #clion #intelij #java #vscode

Last updated 2 years ago

daria-andrea · @daridrea
199 followers · 401 posts · Server graphics.social

E-graphs from A to almost Z. Very well-written and easy to understand.
* may use a similar approach in my own writing. Thanks @ Cole-K. πŸ™Œ cole-k.com/2023/07/24/e-graphs

#datastructures #datastructure

Last updated 2 years ago

Joshua Grochow · @joshuagrochow
537 followers · 559 posts · Server mathstodon.xyz

4-min interview w/ Tarjan on his inverse-Ackermann upper bound for the union-find data structure . Turns out he got a matching lower bound on that algorithm first - I didn't know about the lower bound before! Interesting story behind the path of research.

youtube.com/watch?v=Hhk8ANKWGJ

#complexity #algorithms #datastructures

Last updated 2 years ago

stark@techhub.social:~$ β–ˆ · @Stark9837
417 followers · 2207 posts · Server techhub.social

(8/8) nested in :

**Profiling:** Before optimizing, profile your code to identify resource-intensive areas and focus on the most impactful improvements.
Example: Use Python's `cProfile` module to analyze code performance.

#optimizing #datastructures #python

Last updated 2 years ago

stark@techhub.social:~$ β–ˆ · @Stark9837
417 followers · 2207 posts · Server techhub.social

(7/8) nested in :

**Generators or lazy evaluation:** Use generators or lazy evaluation techniques to process data incrementally, saving memory and improving performance.
Example: Use a generator to read large files line-by-line.

#optimizing #datastructures #python

Last updated 2 years ago

stark@techhub.social:~$ β–ˆ · @Stark9837
417 followers · 2207 posts · Server techhub.social

(6/8) nested in :

**Data compression:** Reduce memory usage by compressing data with repetitive patterns using gzip or zlib.
Example: Compress large text data with gzip.

#optimizing #datastructures #python

Last updated 2 years ago

stark@techhub.social:~$ β–ˆ · @Stark9837
417 followers · 2207 posts · Server techhub.social

(5/8) nested in :

**Appropriate data structures:** Choose data structures based on access patterns. Use dictionaries when accessing elements by specific keys.
Example: Use a dictionary to store items with unique identifiers.

#optimizing #datastructures #python

Last updated 2 years ago

stark@techhub.social:~$ β–ˆ · @Stark9837
417 followers · 2207 posts · Server techhub.social

(4/8) nested in :

**Dictionaries with fixed keys:** If inner dictionaries have constant keys, consider using named tuples or custom classes for better performance.
Example: Replace `{'x': 1, 'y': 2}` with a named tuple or class `Point(x=1, y=2)`.

#optimizing #datastructures #python

Last updated 2 years ago

stark@techhub.social:~$ β–ˆ · @Stark9837
417 followers · 2207 posts · Server techhub.social

(3/8) nested in :

**Use NumPy or Pandas:** For numerical computations or tabular data, utilize NumPy arrays or Pandas DataFrames for faster operations.
Example: Convert a nested list into a NumPy array for mathematical operations.

#optimizing #datastructures #python

Last updated 2 years ago

stark@techhub.social:~$ β–ˆ · @Stark9837
417 followers · 2207 posts · Server techhub.social

(2/8) nested in :

**Custom classes:** Create specific classes for inner dictionaries with fixed keys to improve efficiency, readability, and maintainability.
Example: Instead of `{'name': 'John', 'age': 30}`, use a `Person` class with attributes `name` and `age`.

#optimizing #datastructures #python

Last updated 2 years ago

stark@techhub.social:~$ β–ˆ · @Stark9837
417 followers · 2207 posts · Server techhub.social

(1/8) nested in :

**Reduce nesting:** Avoid unnecessary layers of nesting. Flatten the structure or use simpler data types like tuples when inner dictionaries have few keys.
Example: Instead of `List[Dict[Any, List[Dict[Any, Any]]]]`, consider `List[Tuple[Key, Value]]`.

#optimizing #datastructures #python

Last updated 2 years ago

Jannis Harder · @jix
250 followers · 271 posts · Server mathstodon.xyz

The last few weekends I've been working on my own rust implementation of a forest-of-B+-trees data structure, which is very useful for representing dynamic graphs, very similar to cranelift_bforest (docs.rs/cranelift-bforest/late)

My main motivation is that I want to a) have a larger branching factor to reduce the number of random accesses during iteration b) have size optimizations for small trees that don't even fill half a single node and c) keep track of the size for every subtree, so every tree can efficiently be used as an order-statistic tree as well as for optimizing multi-tree operations like intersection or more general joins.

This weekend I've got single item insert and remove fully implemented and did some fuzzing which did find the one place during rebalancing where I forgot to update the subtree size.

I also did some limited initial benchmarking, and after a bit of profiling and adding inline annotations the performance looks promising. Quite a bit faster than Vec<BTreeSet<T>> and never slower than cranelift_bforest, sometimes even a bit faster. The same is true for memory usage.

These benchmarks are far from being representative of all my use cases, but they do give me confidence that this isn't going to be a complete waste of time :)

Before publishing a first version I still have to come up with a name for the crate though and I want to implement a bit more of the basic functionality you'd expect to have, like iteration :D

#datastructures #rustlang #rust

Last updated 2 years ago

Margaret Eldridge · @pragmaticmarg
95 followers · 375 posts · Server hachyderm.io

Today on Medium, an excerpt from the new Python version of A Common Sense Guide to Data Structures and Algorithms by Jay Wengrow:
medium.com/pragmatic-programme

If you like the excerpt and want the book, head over to DevTalk to find a 35% off promo code:
devtalk.com/books/a-common-sen

#datastructures #algorithms #python #pragprog #books

Last updated 2 years ago

Beej · @beejjorgensen
126 followers · 259 posts · Server mastodon.sdf.org