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.
-4
votes
0answers
17 views
2
votes
1answer
18 views
Printing the minuend and subtrahend in a Minimum Difference algorithm
I have a Minimum Difference algorithm, and I wanted to expand on it by printing the actual elements that were subtracted. I'm just wanting to know if this is the best way to do it.
...
1
vote
1answer
61 views
NDArrays in C: slicing/transposing/polynomials
This is the primary module for my APL interpreter. The general idea is motivated by my two Stack Overflow questions, but the details I fear are easy to get wrong and I suspect there are a few corners ...
2
votes
1answer
73 views
Poker app in C#
I am developing a poker application using C#. It is almost done, and I'm looking for improvements. One of the things I wonder is whether I should change my method that checks if the player has a ...
2
votes
1answer
55 views
2
votes
2answers
56 views
4
votes
2answers
75 views
DoublingQueue in Java
Inspired by this CR question, I decided to create my own queue! If you guys see anything taboo or have any improvements, please let me know. Ultimately I want it to be feature rich and bug free, with ...
-1
votes
1answer
47 views
&(array[index]) vs (array + index) [closed]
So I'm working with a function that returns a pointer to a list item. Right now, I'm using:
...
11
votes
5answers
529 views
FiniteArrayQueue type with interface and unit tests
Doing some exercises on basic data structures, I learned about queues, and decided to roll my own to better understand how a basic queue can function. As the name indicates, this Queue is made from a ...
2
votes
2answers
122 views
Efficiency of vector like class
I've written a vector-like class in C++ and I'm trying to figure out issues in efficiency. When I use clock() to measure the time taken to emplace objects, ...
2
votes
2answers
84 views
Array-based deque in Java
Are the conditions which I have included for insertion and deletion from front and rear sufficient and necessary? Have I missed some condition check? Or have I included some redundant condition?
...
0
votes
1answer
39 views
Java two arrays of audio, or one array? how to determine the most effective
Okay so I have some code, I want to play some audio of two byte arrays, I was wondering whether it would be better to play them as two separate arrays both calling the method or to put them into one ...
-3
votes
1answer
105 views
Rewrite a javascript function in a better way
From the below array $data, I place price for each month for one category in first array. If no data is found for the particular category for a month, inset 0, ...
1
vote
0answers
9 views
Optimize KnockoutJs Pagination Computed Function
I have written a function that builds an array of paging options for rendering on the view.
I have modelled it after DataTables for jQuery, a live example with lots of data is available here: ...
2
votes
2answers
49 views
Make binary search tree from sorted array
Here is my code for converting a sorted array to a binary search tree. Please review and let me know the improvements or some better way of solving this.
...
3
votes
0answers
34 views
Implementing a templated Array class
I have implemented an Array class using templates. I have used a std::allocator object for memory allocation. Will it be better to use operator new along with placement new for memory allocation?
...
-2
votes
1answer
35 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 ...
8
votes
4answers
117 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
59 views
2
votes
1answer
49 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 ...
4
votes
2answers
63 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
216 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 ...
6
votes
3answers
220 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
74 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
22 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 ...
2
votes
3answers
95 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
52 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
288 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
60 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
81 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
74 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
91 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
166 views
Array is Balanced Array or Not
A balanced array is defined to be an array where for every value n in the array, -n also is ...
4
votes
1answer
31 views
Array is Twinoid Or Not
A twinoid is defined to be an array that has exactly two even values that are adjacent to one another. For example ...
4
votes
2answers
191 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
64 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
135 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
634 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
445 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
53 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
129 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
62 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 ...
2
votes
1answer
45 views
Loading images in the background for a table view
I have fetchData method which fills my imagesArray:
...
8
votes
2answers
83 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
450 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
78 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
48 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
88 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 ...