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

0
votes
0answers
10 views

from json array to variable or mysql [on hold]

I have this script to display some value from a json file: ...
-1
votes
4answers
60 views

Unique values of an array

I'm curious if there is another way to code this. Could it be done with a while loop for instance? ...
0
votes
0answers
10 views

Array Menu Switch Options, Black Executing Program [on hold]

This is some code put together using an array to store numbers using a menu to let the user input, delete, and sort data. The compiler doesn't seem to have any issues, but executing the program ...
5
votes
0answers
37 views

Battleships Player vs Computer Algorithm

I am a Year 12 student studying CS for my A-Levels. I have had previous Python experience but it is obviously not to professional/industry standard. Therefore, my goal for this review is for my code ...
3
votes
1answer
42 views

List abstraction using array

Following this reference, below is the list abstraction implementation using array, ...
-4
votes
0answers
19 views

Merging of nested arrays based on key value [on hold]

I have to merge 2 arrays with key value as follows: ...
0
votes
0answers
17 views

UDFs with Header-Case selection is too slow

I am working at a project where we implemented 10 different UDFs which gave us high flexibility and a clean code but basically screwed the file up as the file got super slow in the end: The problem is,...
0
votes
1answer
38 views

Searching in array by key => values

I need to write a function that searches the two-tier board according to certain parameters, which works, but I question whether there is a simpler, lighter way to perform this task. ...
1
vote
2answers
70 views

Merging K Sorted Arrays

My aim is to merge k different sorted array with unique elements and I want a code review about it, here is my code below which is written in java; ...
2
votes
0answers
31 views

Optimize iteration over numpy array with vectorize [closed]

I have the following method which deals with numpy arrays to find the cumulative minimum from each element and its neighbors above: ...
4
votes
1answer
63 views

Finding the indices where a selected player appears in a list of hashes

I have an array of hashes in a YAML file. When I run the code below it is VERY slow. My YAML pwsarr.count is about 2000. I am somewhat new to Ruby so I don't know ...
3
votes
3answers
31 views

Summing durations associated with each MAC address in a MongoDB result

I have a script which get data from MongoDB in the form of array and show the result. The array has a number of records in the thousands. A sample array is as follows: ...
2
votes
1answer
65 views

Find the longest subarray with sum less than K

The problem consist of finding the longest contiguous subarray with a sum less than a given integer K. The input data are: K - ...
3
votes
0answers
43 views

Perlin Noise Generator - Round 2

After a good first review, I've much improved my code which is generating Perlin Noise as a means of 2-D terrain generation. My first attempt was not very well met because at the time it was a lot ...
6
votes
4answers
110 views

Repeatedly partitioning an array equally as far as possible

I solved HackerRank Nikita and the Game. The implementation is correct as program passes all test cases. Nikita just came up with a new array game. The rules are as follows: Initially, ...
1
vote
2answers
92 views

Perlin Noise Generator

I'm porting a 2-D Terrain Generator from Python to C++ as Python is too slow due to the number of features that have been added. I'm new to C++ and would like to know of any criticisms that you can ...
3
votes
0answers
20 views

Extending Array to make a stack that bubbles unused objects up and active object down

Array.prototype.fastStack To combat GC and its impact on animation I created Array.fastStack that adds to the array prototype. It's a sort of stack that bubbles ...
3
votes
1answer
53 views

Unfold a 2D array spiral in C#

The purpose of this function is to turn a 2D array of sorts into a single-dimensional array by reading it in a spiral fashion. In the array: 1 2 3 4 5 6 7 8 9 ...
4
votes
2answers
73 views

x86 assembly function that determines whether an array is continuous

I wrote an x86 assembly function using MASM that tests for whether or not an array is continuous. That is to say, if an array with length n that starts with the value k, all the subsequent entries in ...
5
votes
1answer
707 views

C program circular array rotation

I'm trying to solve a Hackerrank problem where you perform k array[n] rotations, and at the end, ask for ...
0
votes
1answer
40 views

Preferred implementation of `Array<T>::operator=(const Array<T> & rhs)`

I have a custom template class Array<T>, and am currently implementing the assignment operator. However, I've come across a design decision: When assigning ...
5
votes
0answers
32 views

Grouping, merging and mapping with a timetable

I want to create a "timetable" for some shop. It should look like, "days - hours". I get response from the server in this way: ...
0
votes
1answer
50 views

Grouping sub-arrays with nonidentical items

I have a 2D array like ...
2
votes
4answers
144 views

Circular array rotation Java

I have a solution to the HackerRank Circular Array Rotation challenge. It passes 7 test cases out of 15. The rest of them are getting timed out. I think it's because of the huge data set that has ...
1
vote
3answers
60 views

Finding the nth machine encountered on the journey

Recently I came across this problem in the IARCS server,here is an little excerpt from it, A well-known bandit who used to haunt the forests around Siruseri was eliminated by the policemen a few ...
2
votes
0answers
36 views

Converting [UInt32] -> [UInt8] -> [[UInt8]]

I am trying to speed up my current implementation of a function that converts [UInt32] to a [UInt8] which in turn is split up ...
1
vote
3answers
54 views

Look for patterns in the keys of an array, to group them in a new array

I am working on a function that will take a an array of options. These options are retrived from a database, and could have other options inputted throughout the system. When adding my options, I am ...
3
votes
0answers
103 views

Google Foobar power_hungry challenge

I'm trying to do the power_hungry challenge of Google FooBar. Here's the problem for context: You need to figure out which sets of panels in any given array you can take offline to repair while ...
4
votes
3answers
166 views

Tic-Tac-Toe game simulator in Java

I've completed this Tic Tac Toe simulator in java and so far it's working. It's just supposed to generate a pre-played game and announce the winner. I'm required to use a 2D array and this is the way ...
3
votes
1answer
110 views

Simple Employee Records Program

I am a beginner Java programmer. I have just finished up an assignment and would appreciate some advice and/or criticism on my program. For context, I have the assignment details, followed by the full ...
1
vote
1answer
69 views

Array choice based on template specialization

I've got these two template functions responsible of adding/removing actors in-game in GameEngine.h: ...
2
votes
2answers
66 views

FIFO Queue Implementation

My Implementation of a FIFO queue. I am mainly curious about my initialization of empty generic arrays. ...
4
votes
4answers
77 views

Transposing a PHP associative array

The purpose of this code is to change each column to a row, and assign keys to each value for the new array according to the old array. I would like to know if there're other ways to optimize it. <...
2
votes
1answer
93 views

Find the number of K-Complementary pairs in an array

Below is the program to find k-complementary pairs: K = A[i] + A[j];. ...
4
votes
1answer
82 views

2 Player TicTacToe Game

I am a beginner Java programmer and I have just finished creating a simple 2 player TicTacToe game and would appreciate some feedback/advice on how to make it better. ...
0
votes
1answer
47 views

Recovering permutation from its image sequence

Recently while practicing I came across this problem , here is an excerpt from it, A permutation of the numbers 1, ..., N is a rearrangment of these numbers. For example 2 4 5 1 7 6 3 ...
1
vote
1answer
102 views

Integer sum program

This is a little assignment I am working on. I am a beginner Java programmer and would love some advice on how to improve this code. For more context, here are the assignment details: Create a ...
11
votes
2answers
128 views

Python ASCII-Art Table

As a part of a console utilities module, I created a function that takes a table in the form of an array of arrays, and generates an ASCII table with the given contents. I've also added the options ...
0
votes
1answer
27 views

Shifting an array with less touches

I have an array that I am shifting by a certain number of spaces. I am wondering if there is an better way to do the shift with less touches. Here is my code ...
4
votes
2answers
131 views

Dynamic Array container in macros

The code below is an attempt to mimic std::vector from the C++ standard library in the C language. The implementation is purely macros, in the C99 dialect, and ...
-1
votes
2answers
44 views

k times left rotation of array [closed]

Left rotate array (a), k times, n is size of array. I know, we can calculate n, but prototype is mentioned in respective question. ...
5
votes
2answers
119 views

Imperative Sieve of Eratosthenes using destructive updates in Haskell

I've implemented the prime sieve of Eratosthenes in Haskell using a mutable array of unboxed Bools instead of the usual pure and immutable datastructures. My main concern with this code is speed. For ...
3
votes
1answer
50 views

“Expanding” a 2d array into a 1d array

I'm attempting to write a (hopefully) efficient way of "expanding" a 2d array into a 1d array. Let me illustrate what I mean: Given the 2d array ...
3
votes
2answers
55 views

Calculate amount of elements in collection by property

I was given this task: Calculate amount of elements in collection by property: "name" ...
5
votes
1answer
64 views

Next, greater permutation of digits of a number

Was looking at this question (which I initially misunderstood completely), to which Peter Taylor posted a good answer outlining a much better algorithm. For kicks, I implemented it in Ruby, but I ...
7
votes
1answer
162 views

Search in a JSON structure after a key

This code is supposed to search for a specific key in a object or an array or a mix between both. Is there anything I can improve? ...
3
votes
1answer
62 views

Finding an object in a nested object/array structure

I have an app with a bunch of questions defined in a yaml file. For various reasons I would like the data to be divided into sections (section_0, ...
0
votes
1answer
69 views

Finding pair in an array with the OO approach

Description: I am trying to solve algorithmic problems mixing them with Object oriented design as part of my interview preparation. So, the question is given an array of integers find the pair of ...
1
vote
1answer
114 views

HackerRank: Left Array Rotation in Python

Here is the problem on HackerRank. I want to know how I can improve this code. I am mainly trying to improve the following skills: Documentation, functional programming (top-down approach), accurately ...
3
votes
1answer
61 views

Array wrapper concept with method chaining that provides a fluent interface

I've been working on a class(2 actually) that wraps around the array data structure of PHP. It doesn't bring anything new to the table, it simple makes the function ...