AmitDiwan has Published 10744 Articles

Difference Between Internal and External fragmentation

AmitDiwan

AmitDiwan

Updated on 19-Apr-2021 06:32:01

1K+ Views

In this post, we will understand the difference between internal and external fragmentation −Internal FragmentationThe difference between the memory allocated and the space required is known as internal fragmentation.In this fragmentation, fixed-sized memory blocks are used to process data.This process occurs when a method or process is larger than the ... Read More

Difference Between Contiguous and Non-contiguous Memory Allocation

AmitDiwan

AmitDiwan

Updated on 19-Apr-2021 06:30:11

2K+ Views

In this post, we will understand the difference between contiguous and non-contiguous memory allocation −Contiguous Memory AllocationIn this allocation type, the consecutive blocks of memory is allocated to a file/process.It executes quickly in comparison to non-contiguous memory.It is easy to be controlled by the operating system.Minimum overhead since there are ... Read More

Difference Between Linker and Loader

AmitDiwan

AmitDiwan

Updated on 19-Apr-2021 06:07:03

13K+ Views

In this post, we will understand the difference between a linker and a loader −LinkerThe main function of the linker is to generate executable files.The linker takes the input as the object code which would be generated by a compiler/assembler.The process of linking can be understood as a method to ... Read More

Reversing all alphabetic characters in JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Apr-2021 13:45:11

132 Views

ProblemWe are required to write a JavaScript function that takes in a string str. The job of our function is to reverse it, omitting all non-alphabetic characters.ExampleFollowing is the code − Live Democonst str = 'exa13mple'; function reverseLetter(str) {    const res = str.split('')    .reverse()    .filter(val => /[a-zA-Z]/.test(val))   ... Read More

Finding sum of sequence upto a specified accuracy using JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Apr-2021 13:40:35

172 Views

ProblemSuppose the following sequence:Seq: 1/1 , 1/1x2 , 1/1x2x3 , 1/1x2x3x4 , ....The nth term of this sequence will be −1 / 1*2*3 * ... nWe are required to write a JavaScript function that takes in a number n, and return the sum of first n terms of this sequence.ExampleFollowing ... Read More

Implementing custom function like String.prototype.split() function in JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Apr-2021 13:39:53

1K+ Views

ProblemWe are required to write a JavaScript function that lives on the prototype object of the String class.It should take in a string separator as the only argument (although the original split function takes two arguments). And our function should return an array of parts of the string separated and ... Read More

Implementing partial sum over an array using JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Apr-2021 13:39:29

363 Views

ProblemWe are required to write a JavaScript function that takes in an array of numbers. Our function should construct and return a new array in which each corresponding element is the sum of all the elements right to it (including it) in the input array.ExampleFollowing is the code − Live Democonst ... Read More

divisibleBy() function over array in JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Apr-2021 13:39:03

155 Views

ProblemWe are required to write a JavaScript function that takes in an array of numbers and a single number as two arguments.Our function should filter the array to contain only those numbers that are divisible by the number provided as second argument and return the filtered array.ExampleFollowing is the code ... Read More

Inverting signs of integers in an array using JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Apr-2021 13:38:36

220 Views

ProblemWe are required to write a JavaScript function that takes in an array of integers (negatives and positives).Our function should convert all positives to negatives and all negatives to positives and return the resulting array.ExampleFollowing is the code − Live Democonst arr = [5, 67, -4, 3, -45, -23, 67, 0]; ... Read More

Converting km per hour to cm per second using JavaScript

AmitDiwan

AmitDiwan

Updated on 17-Apr-2021 13:38:13

676 Views

ProblemWe are required to write a JavaScript function that takes in a number that specifies speed in kmph and it should return the equivalent speed in cm/s.ExampleFollowing is the code − Live Democonst kmph = 12; const convertSpeed = (kmph) => {    const secsInHour = 3600;    const centimetersInKilometers = ... Read More

Advertisements