Skip to content

rossiss/JavaScript-Arrays

Repository files navigation

JavaScript-Arrays

JavaScript Arrays Homework Tasks

//I have used the custom build Telerik Software Academy "js-console" for better output visibility//

  1. Write a script that allocates array of 20 integers and initializes each element by its index multiplied by 5. Print the obtained array on the console.
  2. Write a script that compares two char arrays lexicographically (letter by letter).
  3. Write a script that finds the maximal sequence of equal elements in an array. Example: {2, 1, 1, 2, 3, 3, 2, 2, 2, 1} --> {2, 2, 2}
  4. Write a script that finds the maximal increasing sequence in an array. Example: �{3, 2, 3, 4, 2, 2, 4} --> {2, 3, 4}
  5. Sorting an array means to arrange its elements in increasing order. Write a script to sort an array. Use the "selection sort" algorithm: Find the smallest element, move it at the first position, find the smallest from the rest, move it at the second position, etc.�Hint: Use a second array
  6. Write a program that finds the most frequent number in an array. Example: {4, 1, 1, 4, 2, 3, 4, 4, 1, 2, 4, 9, 3} --> 4 (5 times)
  7. *Write a program that finds the index of given element in a sorted array of integers by using the binary search algorithm (find it in Wikipedia)

About

JavaScript Arrays Homework Tasks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published