Javascript and Priority Queues in coding interviews [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
One pretty big issue I've run into with JS is that it has no in built in priority queue unlike Java or Python (heapq).
I was just wondering in an interview situation, could you propose below solution and essentially 'pretend' that JS does indeed have a native Priority Queue structure:
https://leetcode.com/problems/merge-k-sorted-lists/discuss/10528/A-java-solution-based-on-Priority-Queue
Only asking because implementing a MinHeap is pretty complicated and not sure if I'll able to do it in a high stress environment.

I think it's fair to assume you can use an npm library to make JavaScript have capabilities comparable to other languages.
Google Closure Library has some useful structures implemented in JavaScript.
You can find goog.structs.PriorityQueue here.
Facebook similarly has fbjs.
You can find their Heap implementation here.

Related

Any good programming practices/tools to reduce memory fragmentation in JS? [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 7 years ago.
Improve this question
I was noticing very high usage of memory in Firefox, and I saw pages like Gmail and another heavy web-app I was working on, were >100mb! Looking through and seeing some high "unused-gc-things" in about:memory, I found this bug has been reported here and here and is a common problem without a good solution :(
Is there a good tool for detecting arenas of un-garbage-collectable objects short of compiling a special build of Firefox or other browser? And are there better methodologies of writing web-apps that don't use much memory? I would imagine using ArrayBuffer or asm.js may be more efficient as it has one set memory pool, but that doesn't play well with the usual DOM-based interaction and javascript function-al "class"-based programming of most web-apps.

javascript/Jquery code organisation [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'm creating a php app where almost all requests are in ajax and some Jquery effects, so some of my pages are up to 2000 lines of code, all my jquery in one big $document.ready{}, is it normal? should I be ashamed of showing this code to other developers? or is there a better way of organasing Jquery code ?
Like how many others have said, if it's maintainable and easy to read then it shouldn't be much of an issue. However, in my experiences, code that is organized into separate logical modules were MUCH easier to read and maintain than one long document.
With that being said, the typical workflow these days with tools such as browserify would be to refactor and separate the code such that each file executes a specific task for development purposes and when it is time to deploy to production, one would use a build tool to group/minify and optimize for the browser.

What program does apple uses to create modular javascript files [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 4 years ago.
Improve this question
When I looked at the new MacBook website from Apple I saw a nice smooth scrolling effect on the wireless page. I started digging in the JavaScript and found an uncompressed JavaScript file and I was blown away. (https://www.apple.com/v/macbook/a/scripts/wireless.built.js)
There were so many comments, and you could almost follow what they were thinking when they created this script. I tried to create a JavaScript file like this on my own, but in less than 5 minutes I figured out that it was almost impossible to keep it nice looking and understandable. So my question is: What program does Apple use to create this kind of JavaScript files? It is not a default code editor, but a program that supports built file. There are some good ones out there, but they all have libraries you have to follow, this one is just plain JavaScript and nothing more.
There's no tool to magically make your code look nice.
Apple has a strict code style guide that requires all developers to show discipline when writing code, or their code will be rejected from entering their repo.
It's nothing special really, just proper developer discipline.

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!

What to learn after JavaScript? [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've recently finished watching some beginner JavaScript tutorials; it's quite easy to understand. I'm trying to look for intermediate ones now, but I can't find any. So I've decided to not waste time while looking for some continuation on my JavaScript journey. What should I learn next? I prefer that which is important, and perhaps, closely related to JavaScript.
It depends on what your goal is, and what you have already learned.
If you want to become a web developer, you should learn some server-side web languages like PHP or ASP.NET.
If you want to become a general developer, it would be useful to know systems languages like Java or C++.
If you want to be a computer scientist, studying algorithms might be a good start.

Categories

Resources