An array is an ordered data structure consisting of a collection of elements (values or variables), each identified by one (single dimensional array, or vector) or multiple indexes.

learn more… | top users | synonyms

3
votes
1answer
20 views

Container supporting PeekMax, PeekMin, Sum, and PeekNextToMax v2.0

This is another part of the update to this question. The interfaces are in this question. To summarize, the class is a generic container similar to MaxHeap, but only needs to support the following ...
4
votes
4answers
148 views

Find the locally biggest or equal values including corners in an array

I am looking for a function, that will find in array of n integers highest or equal locally values including corners. My code is probably wrong, and I somehow think solution is in some library like ...
2
votes
1answer
44 views

Array of complex numbers

A class Array which contains two data members: a pointer on array of complex numbers and the length of the array. Implement a function for reading the array. The ...
2
votes
1answer
31 views

Multiple Google Maps using V3 API

I have several Google Maps on one page and each has its own set of Lat/Lng co-ordinates. As a result I have added in the JavaScript options for each one individually as follows: ...
4
votes
2answers
75 views

Free Code Camp - Pairwise

I'm working through the Free Code Camp syllabus and I'm on to Intermediate JavaScript Algorithms. This Pairwise problem was the last challenge in that section. The section came just after "Object ...
4
votes
1answer
46 views

Java 8 find array of countup sums

I have an array of some arbitrary int values; I want to find the array containing the sum of the past elements in the current index. Example: ...
-1
votes
0answers
9 views

Passing arraylist value android [on hold]

I have simple_list_multiple_choice adapter, when I click the button, I need to pass the value of checked item into another class. ...
7
votes
3answers
68 views

Checking whether an array contains all distinct values

This method returns true if any arrays element is equal to another element value, returns False otherwise. ...
3
votes
1answer
23 views

Adjusting Angular.js model based on browser width

I have an Array of 5 objects, some key values need to be changed based on the browser width. ie: 5 cols, 4 cols, 3 cols or 2. vs.streams is an Array which is tied to a AngularJS model. When the ...
1
vote
1answer
65 views

Populating an array from a database

I have a query that populates an array from the database. In some cases, this query returns a great amount of data, (let's say for purpose of an example, 100.000 records). Each row of the database has ...
-1
votes
0answers
13 views

need help replacing hard coded arrays with strings and integers pulled from a text file [on hold]

My program needs to take information from a text file. read it and summarize the information inside. right now i have everything working except for the reading. ive tried all the methods i could find ...
2
votes
2answers
57 views

Heap's algorithm - integer permutation

Integer permutation using Heap's algorithm: ...
3
votes
3answers
134 views

Finding number of palindrome pairs in an array

I am trying to find the number of string pairs in an array that are palindromes. ...
2
votes
3answers
42 views

Transforming data from an array of objects to a nested array of objects

I have an array of objects where each object has a datetime key/value pair: ...
3
votes
3answers
92 views

Creating an array of objects for dictionaries

I wrote a piece of code that creates an array of objects based on the array of dictionaries. The problem is that my solution uses multiple loops imperatively. Let's consider the following case. There ...
5
votes
1answer
64 views

Generic multi dimension grid / array class in C++

I am writing a generic C++14 multi dimensional array for computational science purpose. The "features" so far for the class tries to: store multi-dimensional grid values into a flatten array ...
5
votes
3answers
97 views

Find first unique number from array

I was asked to create a function that return first UNIQUE integer from given array of integers. In a case of success the function return the unique number in a case of failure return -1. The ...
2
votes
1answer
47 views

Sorting an associative array alphabetically

I am using a foreach loop to sort an associative array alphabetically. I would like to know if there is a more proper and/or efficient way of doing it. The array: ...
2
votes
2answers
35 views

Saving array values for a secondary foreach loop

Although used within the WordPress platform, this is PHP focussed question. I have an array of child posts, some have content, some don't. My client wishes to display the posts in alphabetical order, ...
10
votes
5answers
412 views

Mode Calculator

I was doing a puzzle on Coderbyte, and here is what the puzzle stated: Have the function SimpleMode(arr) take the array of numbers stored in arr and return the ...
1
vote
2answers
121 views

Array with enumerated elements

Java program uses the following construction: (provided mainly for context) ...
1
vote
1answer
38 views

Scroll related inline image resizing

I have been working the some project and I'm struggling to find the answer. Right now I'm coding with Angular and there some code that makes me write twice. There only two arrays now but if I have ...
8
votes
5answers
228 views

RingQueue implementation using std::array

I've recently finished implementing a ring queue based on std::array in C++11. I tried to write the code as if I were going to submit it to the C++ Standard ...
11
votes
6answers
377 views

Find common elements in a list of arrays

I need to find the common elements present in all the given arrays. All the arrays are present in another array. I have come up with this solution and it's working. I tried to remove the usage of ...
0
votes
0answers
25 views

Slideshow by array using slice method

I made a slide show using array values, it works, but I strongly believe that the way I did is too long. There should be an easier or more compact way to achieve this. ...
6
votes
3answers
230 views

Sum pairs of numbers in array

This code takes a list of ints and sums their pairs, storing the summed pairs in an array sumPairs, then returning that array. If the supplied array ...
5
votes
2answers
88 views

Splitting string by words to new strings

Function: ...
10
votes
2answers
257 views

Removing duplicates from an unsorted Array

I have written this program to remove the duplicates from an unsorted array. Please review and give me your input on how I can improve it a little more. ...
1
vote
2answers
156 views

Sorting an Integer array

The program sorts the array from lowest to highest and outputs the index of the searched value: ...
3
votes
2answers
52 views

Rendering nested array in a <ol> with headings

I have an array with the following structure ...
-1
votes
0answers
65 views

Optimizing K-means clustering code

I have discovered that the calculation of the new clusters adds quite a bit of time on to the overall runtime of the program. I want to optimize as much of this code as possible. ...
3
votes
2answers
142 views

Checking if an array is initialized and allocated in VB.NET

I am creating an add-in for a piece of software our company uses, so I'm working pretty extensively with that program's API. There are many COM object members which return or contain an array that I ...
2
votes
1answer
52 views

Replace an element of a List with a concrete Id

I want to replace an object of a List with another one. To find the item to replace I need to check the field id of the object ...
3
votes
4answers
489 views

Copy autodiscovery results from list to an array

I copy addresses from the endpoints to an array that should only hold the endpoint addresses. This works but it seems so old school :/ Can I make this faster, better, more sexy (LINQ)? ...
2
votes
1answer
42 views

Class/Event Schedule Calendar

This is a calendar to layout an array of events/classes (from an API) in calendar format: ...
3
votes
3answers
68 views

Dynamic resizeable array

How can I improve this code for a dynamic and re-sizable array data structure? Array.h ...
7
votes
3answers
88 views

Writing a program to read a maximum of 99 elements in an iteration from a list

I want to read a list of elements and pass a maximum of 99 elements to a function for some logical operations. I have tried this with an array as an example and this code was successful in achieving ...
2
votes
2answers
88 views

Selecting results as a comma-separated string

The below code is working correctly, however, I am not sure if the combination of while, foreach and ...
3
votes
2answers
65 views

Add two 4-D arrays in Python

I have two arrays, each with shape (1, 51, 150, 207) I need to add them such that: ...
5
votes
2answers
89 views

Adjacency list with array data

I came through a question on Stack Overflow, which shows this array structure: ...
1
vote
1answer
73 views

Reducing the size of JSON objects

I wrote a function to reduce the size of JSON objects that works simply by turning every associative array into an indexed one, and moving each property's name to the first row of the data array ...
2
votes
2answers
48 views

Converting a 1D Array of Strings to a 2D Array in Python

I was solving this question on a site that gives you a 1d array called grid ...
7
votes
4answers
455 views

Returning an array containing values from two passed in arrays

This is a simple piece of code which takes two arrays supplied as parameters, then appends them to a new array that contains the values from the supplied arrays. Any suggestions for improvement would ...
-1
votes
2answers
53 views

Declaring multiple arrays in PHP with one line

Is it possible to declare multiple arrays in PHP in one line? ...
3
votes
3answers
107 views
8
votes
3answers
729 views

Finding the percentage of even numbers in an array

I wrote a method which computes the ratio of even to odd numbers in an array. I know it's a simple piece of code, but I wanted to see if you have any feedback for improving it. ...
1
vote
1answer
35 views

Query containing array

I want to get the query result that contains all entries from array and some data from the DB. It's like the array is a DB table and by left join I connect the data ...
4
votes
4answers
105 views

Increase performance of a method which finds the element removed from an array

Imagine that you have a TreeSet of numbers, and you copy them into an array, but you remove one element of it. You want to know the element removed. ...
4
votes
1answer
176 views

Find missing numbers in a sorted array

Array of size \$(n-m)\$ with numbers from \$1..n\$ with \$m\$ of them missing. Find all of the missing numbers. The array is sorted. Example: If ...
4
votes
1answer
160 views

Changing array values in PHP

I need to change some array values in a 2-dimensional array for some cases. Sometimes the all values from an child array and sometimes only some values. In this cases I should only change the variable ...