Traveling Salesman Problem implementation language [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
i am trying to develop a web application using HTML, PHP, and java script and i will include the Traveling salesman problem. should i use python for implementation or stick to java script? and what is the difference between them? which one is less complicated?

This ultimately depends on which language you prefer coding it in. If you have much more experience in Python go with that if not stick to JavaScript. If you want a fast algorithm for traveling salesman. I think JavaScript is a lot more faster than Python. This also depends on what algorithm you implement. If you want an easy algorithm to code I would recommend the nearest neighbor algorithm. You can check out more algorithms here if you'd like to know more about that. https://en.wikipedia.org/wiki/Travelling_salesman_problem.

Traveling salesman is not an easy problem to solve efficiently. Luckily, Google, in its wisdom, has a robust implementation: https://developers.google.com/optimization/routing/tsp. So use that.

Adding additional languages to your application adds more complexity to your project. You already have two programming languages and a markup language in your project. Use javascript if you want to solve the problem on the client, or use php if you want to solve the problem on the server. If python is your language of choice, you can serve webpages from a python framework like flask instead of apache/php.

Related

Why is Python so much slower than JavaScript? Could it ever catch up? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I am a PhD student, and I have been creating Python programs to handle massive scientific calculations.
Even after using optimal Computer Science algorithms, my scripts often take hours to complete.
I recently tried to implement some of the heavier functions in JavaScript to compare its performance, and it was 10x times faster right away.
This left me wondering why is JavaScript so much Faster than Python, if both are interpreted languages. Could Python could ever catch up with this performance? (Perhaps restricting a few minor operations, or adding optional declarations to improve speed).
PS. I have read that the performance improvements that I noticed in JavaScript are powered by advanced Google Chrome technology, so I guess my question could be rephrased as asking whether these technologies could also be applied to speed up standard Python.
Here the reason for python to be slow is because, python runs c programme at its backend.
What I meant by it is that every variable/ object you create in python has an 'C' struct defined at its backend for find that variables size,datatype, and other three parameters. Hence, each time you run the python code it first runs that c code in backed and shows you result.
Hence, python is much slower compared to javascript or java.

How to write own scaffolder (like RoR has?) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I would like to create own scaffolder for websites, something like Ruby On Rails has:
rails g modelname fieldlist
But for my own purposes - it should generate HTML, CSS and JavaScript files in proper folders (folder paths will be taken from configuration file) with specific content.
My question is: which language (or tool) is the best for such task?
I was trying to write that using bash but codebase became quick very large and messy.
My target is unix platforms (especially Linux) - I'm thinking about Ruby or Python, but can I achieve such task with e.g. JavaScript/node?
Are there tools for something like that? I've heard something about Yeoman but I'm not sure if it is capable for my problem here.
Well since your question is too broad and you seem to be looking for a website generator, at least for Ruby here are the most obvious choices:
https://www.ruby-toolbox.com/categories/static_website_generation
All of them use templates, which I assume that will be usefull.
One of the most popular choice is the jekyll, which powers github pages
If none of them work for you, you can investigate their source code to create your own solution.
If you are going the rails way there's rails apps composer

New to algorithms, where to begin? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have been struggling as to where to begin learning algorithms because of the insane amount of information out there. I don't have any knowledge on algorithms other than solving a Rubik's cube. I'm wondering what is a good source for a beginner to learn algorithms and if they're useful. I should also mention that the languages I know are PHP, Javascript and MySQL.
Upvote for wanting someting to learn and actually asking.
As #jbarker2160 wrote: Computer-programs are algorithms. If you know MySQLs SQL dialect you might run into the PROCEDURE command. A good example for that.
If you read about Computer history you will soon learn that some early computer programs were nothing else than a series of switch-combinations (on/off) represented by little holes in a paper. Modern programming languages like JavaScript are a high-level abstraction from that "binary" code but deep in their core they still just talk "on" and "off".
Good luck with your programming!

JavaScript VS Handlebars.js [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
What are the benefits of using Handlebars.js, or any other such libraries, compared to just using JavaScript? So far I have not found anything in Handlebars that I cant do in just javascript.
JavaScript libraries make it easier and quicker to do things in JavaScript, anything a library can do, you can do yourself in JavaScript. But why would you? In pure JavaScript, if I wanted to select a element by id, I'd have to do this:
document.getElementById("coolId");
Or in JQuery (a JavaScript library) I could just do this:
$("#coolId");
It's quicker and easier than using pure JavaScript. Hence that's why I use JQuery to select elements and why I many different libraries - because they allow me to do things much quicker and easier than doing it myself in pure JavaScript, think of libraries as 'shortcuts' to achieving your goal functionality.
Edit: The drawbacks
However, whilst JavaScript libraries (generally) make our lives easier, as developers. They do come with drawbacks, including; large JavaScript files to download, taking longer for JavaScript engines to execute the code and, therefore, makes our code less efficient. For more on this, here are some links:
Advantages of using pure JavaScript over JQuery
What are the advantages and disadvantages of different JavaScript libraries?
The Pros And Cons Of JavaScript Micro-Frameworks
Thanks to Lix for the reminder.

technical considerations for including an extraneous javascript library in a Rails project [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I recently included Handlebars.js in a rails project, and a coworker balked at the notion. What are the realistic technical considerations when including an extra javascript library into a rails project?
Does the addition of an extraneous library significantly slow down the site delivery and user experience? Is this an example of engineering drama?
Has this been measured?
Adding additional libraries slows down the site delivery by several hundred milliseconds. It also requires some client time to parse and run its onload()-type functionality. From a human standpoint, it requires a bit of time to get used to using the new library. Depending on the level of complexity, usefulness, and time-saving of the library, this may be an acceptable tradeoff.
Handlebars is a great tool for templating, but you really need everybody on your team to be on board to use it. It's not very nice to simply introduce a brand new way of doing things without really discussing things. Handlebars is a big enough change to warrant at least a discussion, if not a vote.
If you were just wanting to put it there to see if it would work in the future, or maybe just convert over a page or two, then you should do that in a separate branch and do a quick prototype and demo for the team.
Depending on whether there is a valid business case and legitimate usefulness, you and the team can decide whether to convert your application to use it.

Categories

Resources