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

-1
votes
0answers
9 views

How to Make Words random in C? [on hold]

Suppose i have word apple in variable b like this char b[100]; b[]={a,p,p,l,e} How can i generate random string like this: ...
-2
votes
1answer
14 views

Implementing Arrays in Java Class

I have the following code to write: Modify the Student class so that instead of 3 tests you will now have an array of 100 tests. However, not all of the scores may be set. You need to add an ...
1
vote
0answers
17 views

Python Implementation - Conway's Game of Life

This is my implementation of Conway's Game of Life in Python. Now since I am a novice coder, naturally I have some key doubts: The usage of idioms and code redundancies - Are there any small ...
3
votes
2answers
49 views

Sort array of objects with hierarchy by hierarchy and name

I have an array of nested objects: ...
2
votes
1answer
47 views

Matrix column switching

I'm currently working in the math library for a game framework that I'm writing and am working to improve some functionality that was affected during a refactor. Formerly, my ...
0
votes
1answer
37 views

Generate all permutations in C

I have written code for generating all the permutations in C as explained here. How can the code be optimized? Are there any memory leaks? ...
6
votes
2answers
205 views

Automation of array allocation in C

I recently have been working on moving from projects written in Java and C++ to C and realized that the lack of std::vector in C makes it a bit more difficult to ...
-1
votes
0answers
8 views

PHP issue: sending multiple email signup confirmations on newsletter subscription [on hold]

I have the following function that based on checkbox value will add subscriber to corresponding newsletter list. The issue is that is sending one email confirmation per list subscribed, instead of ...
-1
votes
0answers
37 views

Selection sort algorithm for a 2d char array in C [closed]

I am trying to make a selection sort algorithm for a 2d array in C (as the title says), the code compiles but unfortunately it does not sort anything. is there anything I can change that will make ...
-5
votes
0answers
38 views

How is my downheap algorithm? [closed]

I am attempting to downheap on an array from the last interior node all the way up to the root, so that I am making mini-heaps from the bottom up. I have an algorithm that I believe will do this ...
6
votes
3answers
208 views

Loading tab-separated tweet data into an array

I'm working on this school project and was wondering if there was any way of storing this information better, faster, more professionally. I'm also restricted to only using an array; don't ask me we ...
2
votes
2answers
50 views

Slice chunking in Go

I have a slice with ~2.1 million log message strings in it that I am parsing for regular expression matches. For any matches, I add it to a local slice and then return said slice. ...
1
vote
0answers
18 views

Rotating an array left or right [closed]

I'm trying to rotate an int array either left, or right, and I ran into some problems trying to rotate higher numbers. I know what is wrong, but I can't figure out a way to fix my code. Thanks for the ...
1
vote
3answers
86 views

Pascal Triangle implementation in C#

This is my attempt to implement the Pascal Triangle in C#. It is meant to calculate and return a pascal triangle of size n (which it takes is through the parameter ...
3
votes
2answers
50 views

Data Table Report Class

Most of the VBA I write is to produce tabulated reports from spreadsheet data. So, here is my attempt at creating a CLS_Data_Report class. Properties: a ...
4
votes
4answers
273 views

Swapping characters pairs in a string

I have to swap the characters in a string before sending said string to a device to show the information sent through a LCD, the method I developed is as follows: ...
2
votes
2answers
56 views

Function to combine arrays of associative arrays

I recently create a function to combine some arrays of associative arrays in a single array in response to a stackoverflow question, where you can found more details about this. The function works as ...
2
votes
0answers
79 views

Nested loops with linear array

i have found this article on how to loop through multi-dimensional arrays quickly. http://nadeausoftware.com/articles/2012/06/c_c_tip_how_loop_through_multi_dimensional_arrays_quickly I am using ...
4
votes
1answer
71 views

Displaying a randomly sized array as a table

This program creates an integer array with a random size of 5-50 elements (inclusive). It then fills the array with random numbers between 0 - 100 (inclusive). The interesting part comes when I then ...
3
votes
0answers
67 views

GSL-like array_view implementation

I've seen a couple GSL-like string_view-ish implementations on CR recently, but don't recall seeing anything like array_view yet ...
2
votes
5answers
151 views

Array is Balanced Array or Not

balanced array is defined to be an array where for every value n in the array, -n also is ...
4
votes
1answer
30 views

Array is Twinoid Or Not

twinoid is defined to be an array that has exactly two even values that are adjacent to one another. For example ...
4
votes
2answers
188 views

Array is MinMax Equal or Not

An array is defined to be maxmin equal if it contains at least two different elements and the number of times the maximum value occur is the same as the number of times the minimum value occur. So ...
4
votes
2answers
58 views

Find all integers between m and n whose sum of squared divisors is itself a square

Divisors of 42 are : 1, 2, 3, 6, 7, 14, 21, 42. These divisors squared are: 1, 4, 9, 36, 49, 196, 441, 1764. The sum of the squared divisors is 2500 which is 50 * 50, a square! Given two ...
3
votes
3answers
124 views

Algorithm to find leaders in an array

An element in an array X is called a leader if it is greater than all elements to the right of it in X. The best algorithm to find all leaders in an array. Solves it in linear time ...
7
votes
3answers
608 views

Sum all numbers in a range

I have implemented the "Sum All Numbers in a Range" challenge from Free Code Camp quoted below. The code works like a charm, but I don't think it's idiomatic. The challenge hints imply I should be ...
4
votes
3answers
443 views

Write a function named isSuper that returns 1 if its array argument is a isSuper array, otherwise it returns 0

An Super array is defined to be an array in which each element is greater than sum of all elements before that.   For example: {2, 3, 6, 13} is a Super array. ...
5
votes
1answer
48 views

Get Worksheet Data Array (Standard Methods)

I'm re-writing my module of Standard Methods. Virtually every project I do begins with grabbing some number of Data Tables and putting them in arrays. So, this is my general "Get Worksheet Data" ...
8
votes
2answers
126 views

Report Building (Data Retrieval, Validation, Aggregation, Business Logic, Report Building, Visual Presentation)

This: Is a data table we get from our financial platform with lots of useful information. For reference, "--" is also the string they use to denote empty values. This: Is a spreadsheet I built ...
0
votes
2answers
57 views

Compare two associative arrays by key [closed]

I am currently for a program I am writing needing to compare two associative arrays by key and value in PHP and get the common elements as well as the difference between the common elements. I have ...
0
votes
1answer
36 views

Loading images in the background for a table view

I have "fetchData" method which fills my "imagesArray": ...
8
votes
2answers
81 views

Random jagged int array generator

I've been working on learning about irregular arrays and thought making a generator such as this one would be a good exercise in applying what I have learned. The following class generates an array ...
6
votes
5answers
433 views

Print the sum of corresponding elements in two arrays

In this exercise, I'm supposed to sum up elements from 2 arrays, then display the answer on one line with spaces in between. I did it and my answer got accepted as correct, but I'm wondering if there ...
3
votes
1answer
75 views

Refactor of vba function to reduce bloat and repeated code

This takes in an array of data built from a source workbook, builds a set of "flags" based on the data in each row of the array. Then it creates a new finalRng ...
7
votes
1answer
47 views

BitArray (compacting 32 bool values into one integer)

I'm trying to refamiliarize myself with Java and working with it, so I've implemented my own version of a BitArray. Basically, it's an array of integers that maps ...
0
votes
1answer
84 views

Searching a list of an int arrays into another list of int arrays

We are given two list on integer arrays, and the objective is to retrieve another list which contains the duplicates in both lists. The code developed is the following: ...
1
vote
1answer
31 views

Print values of an array while stripping out some parts of the string

Is there a more efficient way to run this? I am especially interested in a way which perhaps does not require a for loop... ...
6
votes
1answer
69 views

Associating degrees with notes of scales

I have a JS file that creates an object with notes from a music scale when given a key (aka tonic/ note). The code works and does what I want it to do. I need a critique on the way it's written, what ...
1
vote
1answer
56 views

Creating a 2-D array whose first elements come from a 1-D array

I am trying to full one dimensional array in two dimensional array in Java.I did it using this way, is there another way better than this? . ...
1
vote
2answers
94 views

Array class to replace all iterator needs

Following dreams, I have started learning Java for Game Programing purposes and, during code I figured out that Iterators such as Queue, Lists, Arraylists and what not are very common. I have written ...
5
votes
1answer
71 views

Extracting the timestamp, minimum score, and maximum score from hundreds of arrays

So this is what I'm doing: I have hundreds of arrays, each of them filled with a date in milliseconds in the first position, and the rest of the array is filled with user game scores. Let's just ...
5
votes
2answers
59 views

Dynarray implementation with iterator

So here is an implementation of a dynarray. Many people might not know about it, so here is a reference. Note that I am not trying to write a 100% standard ...
2
votes
0answers
33 views

Add values to a multidimensional array of unknown depth

I have the following class: ...
2
votes
0answers
39 views

Cluster arrays according to similarity of key values

The below script will compare a set of arrays according to similarities between their key's values. For example, if the first 4 keys values of an array are equal to another array's first 4 keys ...
1
vote
1answer
62 views

Extract numbers from a string-Javascript

Consider the following string in javascript: var string="border-radius:90px 20px 30px 40px"; I want to extract the 4 numbers from that string and store them in ...
4
votes
0answers
78 views

Finding subsets from specified array, avoiding duplicates

I am printing subsets from an array whose sum has been specified, while avoiding duplicates. I think there may be improvements, potentially on how using map is bad ...
3
votes
2answers
185 views

Reverse array in C

I wrote a function to reverse an array. The first argument is an iterable object, the second argument is the size of the array element in bytes, and the third argument is the length of the array. ...
3
votes
2answers
108 views

HashMap or associative arrays in C

I am trying to implement an HashMap in C. I am trying to used a linked list style of interfacing to make adding and removing keys easy and efficient. Searching is ...
3
votes
2answers
80 views

A Slice-type for C++

The Go programming language has that slice type, which is under the hood a pointer to an actual array. This allows treating the subarrays as actual arrays with almost no performance overhead. This ...
1
vote
2answers
56 views

Checking if an element exists in an array efficiently and return it

I am writing a function for my node/angular app that will prompt the user with a random question that he was not asked before. To achieve this I wrote this function: ...