In this task, the goal is to take a combined set of elements and apply a function to each element. C-style Array: #include <iostream> //
Continue ReadingC++: Create a Two-Dimensional Array at Runtime
Get two integers from the user, then create a two-dimensional array where the two dimensions have the sizes given by those numbers, and which can be a
Continue ReadingC++: Array Concatenation
Show how to concatenate two arrays in your language. If this is as simple as array1 + array2, so be it. #include <vector> #include <ios
Continue ReadingC++: Hash From Two Arrays
Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the value
Continue ReadingC++: Move-To-Front Algorithm
Given a symbol table of a zero-indexed array of all possible input symbols this algorithm reversibly transforms a sequence of input symbols into an ar
Continue ReadingC++: Filter
Select certain elements from an Array into a new Array in a generic way. To demonstrate, select all even numbers from an Array. As an option, give
Continue ReadingC++: Loop Over Multiple Arrays Simultaneously
Loop over multiple arrays (or lists or tuples or whatever they're called in your language) and print the ith element of each. Use your language's "for
Continue ReadingWhy is processing a sorted array faster than an unsorted array?
Here is a piece of C++ code that seems very peculiar. For some strange reason, sorting the data miraculously makes the code almost six times faster.
Continue Reading