DEV Community

Brianna
Brianna

Posted on

Do you think there is a language better suited for solving data structures and algorithms?

To give you some backstory on why I am asking this question, I recently got my first dev job as a Front End Developer after graduating from a coding bootcamp this summer, studying MEAN stack. Although, this position is part-time and contract, I'm still job searching for a full-time role, as it's impossible to live in Seattle on part-time income. I'd like my next position to be full-stack and I know I need to strengthen my knowledge of data structures and algorithms (DS&A) to succeed during interviews. The only language I know is JavaScript.

Through my observations, it seems that many people do not code DS&A in JS. While I know people do, as I'm one of them, many resources on DS&A are in Java, C#, Python, or other languages.

Do you think there is a language that is better suited for solving DS&A? Maybe based on native methods or other reasons?

Also if you have any resources you'd like to share, other than Code Wars, HackerRank, LeetCode, Code Fights, I'd love to know!

Top comments (21)

Collapse
 
andy profile image
Andy Zhao (he/him) • Edited

Don't have much to offer about DS&A concepts, besides also recommending Vaidehi.

I've heard interviewing.io is pretty good for practicing questions. Love their blog posts by Aline Lerner, which take a deep dive into the data.

Collapse
 
ben profile image
Ben Halpern

Yeah, it seems like JS is more oriented around practical industry solutions. I would guess that Python is your best bet in terms of being approachable as well as rich in resources that cater to computer science topics.

Technically I think Java and C++ would have the most relevant teachings, but if you're coming from JS, there could be a pretty steep learning curve if you mostly want to focus on the concepts.

I'd love other opinions, though.

As for resources, my head immediately goes towards @vaidehijoshi 's posts. They are quite awesome looks at core DS&A CS concepts, with the most introductory stuff earlier on in the series. She does use JS in her examples, for what it's worth.

Collapse
 
r0f1 profile image
Florian Rohrer

Hi, judging from your description, I think you talk about two separate issues.

1) Learning the basics of computer science. That is, understanding what big O notation is, how data structures work (sets, lists, hashmaps, heaps, trees), and how some simple algorithms for sorting and searching work.

2) Learning a new programming language.

I think you should tackle these issues individually (in part, because at university, they are thought in different courses). For 1) I would recommend you read a book such as "Cormen - Introduction to Algorithms" and getting used to reading pseudocode. If you are not satisfied with pseudocode and want to see how some algorithms look implemented in a programming language, look at Rosetta Code.

For 2) you can use any online resource. You already mentioned some great ones. You can look at Codecademy too, which I found really helpful.

Collapse
 
danieljsummers profile image
Daniel J. Summers • Edited

I'll second Ben's suggestion about Vaidehi's posts - they are great.

Data structures are one of those things that you can get away without knowing for some things, but learning them can keep you from spending a lot of time building something that won't scale. There are some data sets online that you can download and play wi... er, do "research coding" on. Way back in my COBOL (yes, I'm old) newsgroup days, someone posted a link to the text of the KJV Bible, and we all tried different ways to calculate the count of unique words, the frequency of words within the text, the frequence of words by what vowels they contained, etc. It sounds silly, but we all learned lots of different ways to accomplish a problem. For me, it helped concepts click.

When people talk about Python or R (what I'm currently learning for my day job) being good for this sort of thing, they are talking about the ease with which you can do some analysis on the data once you have it. They also have some tools to help clean up the data, if you don't have a nice clean source. (I mean, I made a pie chart today by typing t = table(friends$Friends); pie(t) - crazy!) This is different from what you're wanting to learn at this point. For learning those, whatever language you know is a good one. :)

I'll wrap this long-winded reply with some encouragement. Don't get discouraged if you don't pick up data structure concepts the first time you read them. It was the single toughest class of my entire Bachelor's program; I was grateful to get out with a B-. (Don't be discouraged by my description of it either!)

Best of luck in your educational endeavors!

Collapse
 
djtai profile image
David Taitingfong

I prefer Java and Python. I've found that completing any sort of DS&A problem in Java will generally allow me to be able to solve it in C++/C# (syntax is pretty similar I think). As for Python, I simply like the accessibility and ease of use. You can literally open a terminal window (Mac and Linux at least), type "python", and start hammering away at problems. It's also a lot less to type.

When I have trouble remembering how certain Data Stucs or algorithms work, I use programming-algorithms.net.

Collapse
 
piczmar_0 profile image
Marcin Piczkowski

Java 9 recently released REPL which allows you the same, open Java shell and evaluate the code you type in.

Collapse
 
djtai profile image
David Taitingfong

I didn't know that! That's pretty cool, I'll have to check that out - thanks for the info.

Collapse
 
bousquetn profile image
Nicolas Bousquet • Edited

If you only know javascript and want to get some "full stack" job and greatly widden your possibilities as a software developper, you should give a try to Java.

The language isn't the best, the most shinny or with the most hype. Yet it is quite robust, as the widdest echosystem and suppport of all languages right now (there libraries for everything), it is also the most used overall. This is very important. That where the most jobs, typically for backend or full stack dev.

For you to learn, the language is statically typed, is fine for algorithms, has extremely good support in IDE and comes with an extensive set of standards libraries. The building blocks are also much more robust and organized than what available in node.js.

I'd advise taking at least some coursera or equivalent course on java, try a few home project and importantly, get certified. Getting the 2 basic java certifications for Java8 will show a potential employer you know your job despite you having no diploma in computer science.

On the Java echosytem, the next steps for you would be then to learn the spring framework and dependency injection, likely with JPA, some DB and how to deal with Json/XML parsing to do some full stack project.

For the algorithms parts, a great book or great source online on algorithms and implementing them in java would do the job. Learning search algorithms, graphs, how a map work and so on...

At some point, if I were you'd I'd try to get a diploma in computer science and go to university. They'll teach you very interresting stuff that will deepen your understanding of the subjects, things that are not so easy to get otherwise like how to make your own compiler, the theory behind databases and how to design your data domain well, how a CPU really work and why not if you are interrested design a basic one, what BigData is about and how to get most of the data and so on... Software engineering, how to build complex product and maintain them and so on...

Maybe less in the US than in other places, but it would also help you a lot to get a significant income boost. It is not uncomon in Seatle to get 6 number figure 100K+ salary with a master degree in computer science for a job around Java with some experience. I know just a colleague that got a job at 160K at Seatle, well he is quite experienced, but that give you an idea.

Once you done all of that, you'll want to broaden you vision yet again, and let Haskell and a lisp dialect like clojure. This will give you new ways to do things that even if they are not applicable in most cases to your day job as languages with help you understand advanceds concepts and techniques that can be transposed to your day job.

Another way to go deeper, once you done all the rest is to really ensure you get statistics, data analitics and machine learning. This is were the future seems to be currently with the most interresting jobs. So that would be ensure you get basic maths and statistics right, specialize in machine learnings and learn languages like R and maybe scala with spark or python with the libraries specialized for data manipulation.

Collapse
 
bgadrian profile image
Adrian B.G.

I would say Go, it's way simpler than Python and 10-100x times faster (because it's compiled). Also it makes a very good pair with NodeJS, in my opinion are complementary (write business logic in JS to share code with the client) and move to Go the heavy operations.

Devs make DS&A in JavaScript, but they usually are already built, like in any language, so you do not need too. You wouldn't want to rewrite the MapReduce Mongo algorithm, only if you want to learn how is done.

Collapse
 
ben profile image
Ben Halpern • Edited
Collapse
 
brisourceful profile image
Brianna

Thanks Ben for your reply and for sharing some resources!

Collapse
 
ben profile image
Ben Halpern

Any time!

Collapse
 
ghost profile image
Ghost • Edited

I do recommend use python to learn DS&A. Why? It's a simple language that will allow you to focus less in the language itself and more in the problem that you're trying to solve.

Many colleges start using python to teach DS&A in the last years.

And one great resource to you learn python is learnpythonthehardway.org. It's paid, but if you want to learn python, this is an awesome book (and videos too).

Collapse
 
nickytonline profile image
Nick Taylor

You can definitely use other languages to learn DS & A, but you can still learn about them in JS too. Here's a couple of JS specific resources:

GitHub logo jamiebuilds / itsy-bitsy-data-structures

🏰 All the things you didn't know you wanted to know about data structures

Itsy Bitsy Data Structures

Welcome to Itsy Bitsy Data Structures!

In here are super simplified examples of many of the common data structures written in easy to read JavaScript.

Reading through the guided code will help you learn about what data structures are, what their uses are, and how to discuss them.

Want to jump into the code? Click here

Also be sure to check out my other code walkthrough The Super Tiny Compiler


Why should I care?

Data Structures might not be the juiciest topic in the world, but they are hugely important to growing as an engineer. Knowing data structures don't just make your programs faster and more efficient, but they help you organize your code and your thoughts so that you can build more complicated programs without a ton of mental overhead.

But data structures are scary!

Yeah, lots of computer science topics are intimidating, and that's largely a fault of…

GitHub logo manrajgrover / algorithms-js

Consumable Data Structures and Algorithms library in JavaScript

algorithms-js Build Status Build status npm npm awesome

Consumable Data Structures and Algorithms library in JavaScript

Installation

Run

$ npm install algorithms-js

Or use unpkg:

<script src="https://unpkg.com/algorithms-js/dist/algorithms.min.js"></script>

Or use jsdeliver:

<script src="https://cdn.jsdelivr.net/npm/algorithms-js/dist/algorithms.min.js"></script>

Usage

Library contains both algorithms as well as data structures:

Data Structures

Currently, library supports following data structures:

Algorithms

Currently library supports following algorithms:

Search

Various Searching algorithms:

Sort

Various Sorting algorithms:

Math

Various Math algorithms:

String

Various String algorithms:

Geometry

Various Geometry algorithms:

Development

Run:

$ git clone https://github.com/manrajgrover/algorithms-js.git
$ cd
…

There's also some courses on egghead and Front End Masters, but not free of course.

And as mentioned, @vaidehijoshi , is a great follow for this kind of stuff.

Collapse
 
lluismf profile image
LluΓ­s Josep MartΓ­nez

I'd say Java, its API is simply amazing regarding abstract data types

Collapse
 
danieljsummers profile image
Daniel J. Summers

Forgot to metion - codeeval.com has some challenges you can take; a lot of them are "parse the data and get the result" type exercises.

Collapse
 
dkassen profile image
Daniel Kassen

Python. The syntax is simple, the language is easy to use and get into, the community is huge, and you can build python versions of any data structure you like.

Collapse
 
manulangat1 profile image
manulangat1

Hi all,
I would go with Javascript, yes python has a much clearer syntax but what I found out is that JS and its complexities will help you a long way in getting the basic right, After that, it won't matter what language you are working on because you have the basics right.

Collapse
 
antonrich profile image
Anton

Edabit is like codewars.

Collapse
 
mattmacpherson profile image
Matt MacPherson

But better ;)