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
vote
0answers
27 views

Simple multi-dimensional Array class in C++11 - follow-up

Last week, I posted this question in order to get some comments and critiques on a simple implementation of a multidimensional array class -- hyper_array::array ...
1
vote
0answers
14 views

Compare multidimensional arrays

I'm writing a wordpress plugin that makes changes to the admin menu. To add some context: The wordpress global $menu is a multidimensional array. Each array in ...
7
votes
2answers
99 views

SSE instruction to check if byte array is zeroes C#

My fundamental problem is how to check whether byte[] is full of zeroes. I posted a range of implementations (with timings) and one clearly beats others. In fact, ...
3
votes
2answers
313 views

Find the closest number to each given number

I have a program which works but it is a bit too slow with big numbers. nbBlocs contains the size of the array, it can be up to 20000 and I enter the value inside ...
2
votes
1answer
39 views

Printing polynomials

I am taking a class on ruby and our assignment is to take user input and print out a polynomial. Wondering if I can get any feedback to how to improve my code. ...
0
votes
1answer
27 views

php most elegant function call returning array [closed]

I am asking your preference between two similar solutions. First way : ...
3
votes
1answer
84 views

Little/Big Endian conversion

I wanted to make sure that my code is properly converting between the two endians. Here is the code where I read in an integer: ...
6
votes
1answer
81 views

Simple multi-dimensional Array class in C++11

The new version of can be reviewed in Simple multi-dimensional Array class in C++11 - follow-up. The following code implements a simple multi-dimensional array class (...
5
votes
2answers
59 views

Reorder a list in Python to avoid repeats

I am trying to check if a list has any consecutive repeating elements and then reorder it such that the repeats are avoided. If that is impossible, then return False. For example: ...
0
votes
1answer
23 views
-1
votes
0answers
22 views

Problems figuring out minesweeper code [migrated]

I'm trying to populate a 2-dimensional array with values (numbers) that correlate to the number of mines adjacent to it. My thought process would be to compare ...
2
votes
0answers
39 views

leftMerge function to deep overlay saved state

This code is used to deep overlay saved state (as an object) over a template object, which is the current model, this model can change (e.g have new attributes added), and a simple _.clone call will ...
3
votes
2answers
474 views

Implementing two stacks using single array in java

Please review the code ...
5
votes
1answer
127 views

Kinematic Equations Calculator

The program allows user to enter values for 3 of the following initial velocity final velocity acceleration displacement time and to specify an unknown (one of the previously mentioned ...
5
votes
2answers
118 views

Queue implementation using arrays

Please review the code: ...
3
votes
1answer
35 views

Stack implementation using arrays in Java

Could someone please review my code and let me know if there is any scope for optimization for better performance. ...
4
votes
2answers
59 views

Implementation of a list-like array

This is a follow up question for this question: Implementation of a dynamic list-like array This is an implementation of an array that behaves like a list, granting me an easy and quick way ...
5
votes
2answers
56 views

Implementation of a dynamic list-like array

I needed to address an issue that I met with quite a bit, which has sort of a bag of data that I can easily add items and remove them, and iterate over them at any point without an issue. First thing ...
2
votes
1answer
30 views

Periodically resizing large array

I have a simple socket.io server written in node. Everything is working just fine, however I am curious whether what I am doing is acceptable. I am especially interested in this line ...
4
votes
2answers
377 views

Removing bytes from a byte array

I am reading from a Networkstream, and the response code is: ...
3
votes
3answers
82 views

State flowers and birds

This runs as is, but I'm looking for an alternative way to write it. ...
2
votes
1answer
58 views

Secure array encryption and decryption

I have written the below class which encrypts and decrypts a PHP array. The encrypted data and the hash are sent over an insecure connection and I would appreciate if you could check the code for any ...
2
votes
2answers
72 views

Inversion count algorithm

I implemented the inversion count algorithm using the merge sort approach for this question. The question begins with a number t = number of test cases and then for each test case you input size of ...
10
votes
2answers
271 views

Unique value finder

For our first assignment in our algorithm class we are suppose to solve several different questions using information from a 2D array. We are also suppose to optimize our code to get more marks on our ...
-2
votes
1answer
68 views

Finding the modes of an array

I've a working function. But it feels complicated and doesn't look too good, I would like to improve it. ...
0
votes
1answer
38 views

Structuring a JSON array with objects

I have a JSON array or literal (passes through JSON.parse). Requirement: an array of tasks which contains operations which are key/value pairs. Array of tasks > Array of operations (array of ...
2
votes
1answer
91 views

Project Euler 4 The Functional Way

I'm learning Scala (and functional programming). Is there a better way to solve Euler problem 4 than either of these two solutions. Euler 4 I like this array comprehension solution, but it wastes so ...
2
votes
1answer
35 views

Create a Tree Node from JavaScript Array

I'm trying to create a list of subpaths from a flattened array. Here's the starting point: ...
2
votes
2answers
41 views

K&R atoi() variation

I'm currently learning C with The C Programming Language by K&R and this is my current exercise: Rewrite appropriate programs from earlier chapters and exercises with pointers instead of array ...
4
votes
2answers
223 views

“Breaking out” elements from an array

I wrote a method that takes an array T[] array (T is a type parameter) and a second array ...
1
vote
0answers
27 views

Turning a 2D array into a tree

I have the following data structure that's obtained from a third party: ...
1
vote
1answer
41 views

Reorganizing a PHP array structure (arrays within arrays)

I have this array within array which contains a lot of values: ...
7
votes
2answers
140 views

Deca dimensional ascending and descending array sort function

Some folks told that a two-dimensional array can solve almost all the problems, but let me disagree with that. That's why I made this Deca dimensional array sort function. The array must be ...
3
votes
3answers
155 views

Storing and processing large arrays to compute dot products

Problem Statement (from HackerRank) We have two arrays \$a\$ and \$b\$ of length \$N\$, initially all values equals to zero. We have \$Q\$ operations. Let's define three types of operations on ...
4
votes
2answers
107 views

Reading a sequence of characters and dynamically splitting into multiple arrays

I am trying to read a sequence of random characters, integers and symbols from the standard inputstream, split it into 3 separate arrays (uppercase, lowercase and numeric) and print them in that order ...
1
vote
1answer
81 views

Checking to see if all values in an array are equal

I have an array that might be either one-dimensional, two-dimension, or three-dimensional. I'm wanting to check to see if all values in a given direction are constant. Here are 3 functions: ...
6
votes
2answers
75 views

2D array to draw a letter 'F'

This is my code to print letter 'F' with nested loop 2d array. Are there changes that could be made in it to make it look better or more efficient? ...
5
votes
2answers
76 views

Fluent API for creating random integer arrays in Java

Now I have this fluent API for creating random integer arrays. I can say that I want an array of particular length, having a particular minimum/maximum values and using a particular (or default) ...
2
votes
1answer
64 views

Deleting duplicates from a string

I'm pretty new, but I'm always looking for different/better ways to solve these problems as it helps me understand it better and hopefully will make me better programmer. Feel free to point out any ...
0
votes
4answers
236 views

My own method for sorting numbers in array

I've written some method for sorting asc and desc numbers in array. All I want to know is this good logic, and is there a space for improving this code? ...
5
votes
3answers
74 views

Finding unique values in an array with possible nested arrays

I'm writing a function that receives an array and returns an object with the count of unique values, pretty much like other questions here or in StackExchange. Except that in my case, this array may ...
2
votes
2answers
157 views

Sorting dates (DD/MM/YYYY) with insertion sort [closed]

I'm having troubles with a coding problem. Yes, I need to write a C++ program which sorts dates. I've tried several methods. Using 2D arrays and now parallel arrays. The problem I have with my ...
3
votes
2answers
49 views

Nested Skips (UPenn)

Exercise 1: skips :: [a] -> [[a]] The nth list in the output should contain every nth element from the input list. For example, skips "hello!" == ["hello!", "el!", "l!", "l", "o", "!"]. ...
1
vote
4answers
139 views

Find the longest sequential same character array

I am a new guy to Java. I want to find the longest sequential same character array in a input character arrays. For example, this character array: bddfDDDffkl ...
21
votes
4answers
3k views

“ONCE”, “UPON”, “A”, “TIME”

I'm working on a small program to perform various tasks on text content, primarily at the word level. I wrote these methods as ways to help prepare the raw text file into something more malleable, ...
7
votes
1answer
103 views

Stack using an array

I designed a simple drop-out stack a while back. Basically, I just want to get a few opinions on whether or not this is a good implementation and whether I am understanding the concept of a drop-out ...
8
votes
0answers
45 views

Creating a pseudo Pivot Table / Database using a 4-D array

Why am I not just using a Pivot Table / Database? a) I've never ever used either before. And I don't have time to learn how before this project needs to actually be finished. b) The final output ...
5
votes
1answer
47 views

Defining array contents using multiple statements on one line

I'm writing a sub which is going to determine which type of business is being detailed on a particular line of data. It's going to use column positions to check if the data exists, and then output the ...
3
votes
1answer
146 views

Duplicate integers in an array

Code shows duplicate values of integers in an array with indexes and the number of occurrences. Can you please critique my code and provide your thoughts on where I should improve my code? ...