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

-2
votes
0answers
16 views

Manipulating strings in C++ [on hold]

I'm working on this assignment for class and I've ran into a problem. The objective of the program is to have the user to Input their first then last name. Then the program will ask to in put a ...
-3
votes
0answers
22 views

putting symbols center of m x n board [on hold]

I have written a code that puts symbols on a board that is n x n. How can I improve my for m x n ? Original algorithm: ( It ...
0
votes
1answer
48 views

Sort and rank the array list [on hold]

What I have to do is to sort the array list and then rank them in descending order. I have to write a method to sort and display the names according to their final scores decreasingly. The output ...
0
votes
0answers
12 views

count the number of zeroes in the array and return count [closed]

I need to count the number of times zero occurs in my array and i've just not been able to figure it out heres what i have can some one help me out?package package Arrays; import java.util.Arrays; ...
-1
votes
0answers
23 views

Identify IP Addresses [closed]

I have a code project that is designed to identify Matching IP Addresses in two files. In order to accomplish this, I stored the IP addresses in different arrays and now trying to compare. I have ...
3
votes
1answer
70 views

Read text file filled with numbers and tranfer to an array in Java. Then use threads to help calculate the max in the array

This is my ProcessDataFileParallel.Java file. I'm taking numbers from a txt file and putting it into an array in Java. While it works, I would like to improve the code and possibly change some ...
2
votes
1answer
60 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 ...
2
votes
1answer
37 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
109 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
330 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
40 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
32 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
119 views

Simple multi-dimensional Array class in C++11

The new version of the code 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
61 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
41 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
480 views

Implementing two stacks using single array in java

Please review the code ...
5
votes
1answer
133 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
122 views

Queue implementation using arrays

Please review the code: ...
4
votes
1answer
41 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
57 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
392 views

Removing bytes from a byte array

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

State flowers and birds

This runs as is, but I'm looking for an alternative way to write it. ...
2
votes
1answer
65 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
73 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
275 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
69 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
39 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
94 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
42 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
43 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
226 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
31 views

Turning a 2D array into a tree

I have the following data structure that's obtained from a third party: ...
1
vote
1answer
44 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
113 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
82 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
78 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
256 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
80 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
209 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
51 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", "!"]. ...