The array tag has no wiki summary.
0
votes
2answers
86 views
Algorithm to increase odds of matching when randomly selecting
I am building a mobile game loosely based on dual n-back http://brainworkshop.sourceforge.net/tutorial.html
Now with the game I have 9 squares (numbered 1 through 9) and 9 letters (A through K)
In ...
-1
votes
0answers
18 views
VB6 uart app not reading correct port values [migrated]
for some reason my bytInputArray is only getting the values 255 and 254 when it should be grabbing a 0 - 255 range. basically i declare a buffer as a variant, then convert the individual variant ...
-5
votes
0answers
62 views
Why is there a difference in length property between string variable and array? [closed]
Basically, I was programming and I encountered a problem and then I solved it by realising that I had to put .length instead of .length() to get a number of array size for my calculations. Why is ...
-1
votes
0answers
31 views
How do you convert a CSV file into a 2D array in Java or C++ [migrated]
My question title didn't fully outline my question. I have a text file that has many lines of data with each line in the following format:
a, date, b, c, d, Username, e, Description
a,b,c,d, and e ...
0
votes
1answer
135 views
Sorting an ArrayList by a Split Value [closed]
I am attempting to create an list which should be sorted by a particular field in a colon separated string. I have an array of strings with the following values:
name1:535
name2:697
After sorting ...
3
votes
2answers
156 views
Implementing non-fixed length array support in a compiler
I'm thinking of building a language for PIC microcontrollers. I want to be able to use non-fixed size arrays, like this:
Declare the variable as int[]
Wait for input from serial connection
Make the ...
3
votes
4answers
301 views
Retrieving maximum value from a range in unsorted array
I have an unsorted array. I have queries in which I give a range and then the maximum value from that range has to returned.
For example:
array[]={23,17,9,45,78,2,4,6,90,1};
query(both inclusive): 2 ...
2
votes
3answers
322 views
How do you find the first common element in two arrays
The way I did it was to loop through each at the same time and add the current value to a separate set for each of the lists. Also, check if the current element is already in the other list's set. I ...
-4
votes
1answer
307 views
Program to verify all words in a crossword puzzle are valid
I have my own solution and wanted to check it against something online but couldn't find any examples. How would you solve this one. (I can post my code if necessary). I just want to see if someone ...
5
votes
2answers
261 views
Which design pattern is illustrated by inheriting IStructuralComparable interface?
We know that some design patterns are found so useful that they become features of the language itself.
For instance, the interface IEnumerator which is implemented by Array object.
This helps in ...
1
vote
0answers
33 views
Trying to draw multiple routes on a map [closed]
I have a piece of code here that plots a group of points on a map, and then joins them to draw a route. I want to draw multiple routes on the same map though, and I'm not sure how to do that. Can ...
0
votes
3answers
231 views
A simple algorithm for finding duplicate floats [closed]
We have N numbers(real numbers(float)).They can be positive or negative or anything we do not know except the fact that there is exactly one number which has a duplicate and the rest all are distinct. ...
3
votes
1answer
262 views
The array class in C# - Implementation questions
I am studying the Array class in C#. The following is the implementation of System.Array class:
[SerializableAttribute]
[ComVisibleAttribute(true)]
public abstract class Array : ICloneable, IList, ...
0
votes
3answers
236 views
Count true array elements
In my code (Python+numpy or Matlab, but issue can apply to any array programming language), I often need to count the number of elements in an array where the elements are true. Usually, I implement ...
5
votes
5answers
555 views
What's the effect of this assignment (whatever the language)?
I think my book (Programming Languages: Principles and Paradigms) is wrong. a is a vector, assume a C-like language:
b = 0;
a[f(3)] = a[f(3)] + 1;
int f(int n) {
if(b == 0) {
b = 1;
...
3
votes
4answers
2k views
Initializing char array with string
I don't remember how I got to the thread, but I was reading its replies and one of them states that you should never initialize a char[] with a string literal.
My question: Is initializing a ...
0
votes
6answers
444 views
Visualization of N>2-D array? [closed]
I have an array of dimension 5. But, I can't figure out how to visualize that array?
int[][][][][] array = new int[4][4][4][6][2].
Is there a good way to visualize arrays with dimension counts of 3 ...
0
votes
3answers
397 views
How to efficiently store IP addresses? [closed]
Background
I have a requirement where I need to remove a few nodes in a network based upon a command given by the user. To keep the nodes from transmitting or receiving data I thought of changing its ...
3
votes
2answers
484 views
Should the 12-String be in it's own class and why?
This question is regarding a homework project in my first Java programming class (online program).
The assignment is to create a "stringed instrument" class using (among other things) an array of ...
5
votes
3answers
285 views
Generating Deep Arrays: Shallow to Deep, Deep to Shallow or Bad idea?
I'm working on an array structure that will be used as the data source for a report template in a web app.
The data comes from relatively complex SQL queries that return one or many rows as one ...
0
votes
1answer
219 views
Java Dynamic Binding
I am having trouble understanding the OOP Polymorphic principl of Dynamic Binding ( Late Binding ) in Java. I looked for question pertaining to java, and wasn't sure if a overall answer to how dynamic ...
-2
votes
4answers
528 views
C simple arrays and pointers question
So here's the confusion, let's say I declare an array of characters
char name[3] = "Sam";
and then I declare another array but this time using pointers
char * name = "Sam";
What's the ...
3
votes
3answers
396 views
Is there a way to add unique items to an array without doing a ton of comparisons?
Please bare with me, I want this to be as language agnostic as possible becuase of the languages I am working with (One of which is a language called PowerOn). However, most languanges support for ...
0
votes
3answers
5k views
2 Dimensional Arrays in C++
I started learning arrays in C++ and came over a little side note in the book talking about 2D arrays in breif.
I tested it out and i was amazed that it could give the programmer the ability to store ...
0
votes
2answers
432 views
Should I create specific classes for JSON Objects or only use the container(Array/Dictionary) for accessing Data?
I'm using Foursquare to get a List of Restaurants nearby inside an iOS app. The Result is stored in an Array which consists of Dictionaries and regarding how deep the Data is, each Dictionary contains ...
2
votes
3answers
611 views
C Flexible Arrays: When did they become part of the standard?
I learned to program in C many years ago, and used C steadily for about 10 years.
These days, I occasionally have to look at C code, because our Informix 4GL RDS customized runners also contain C ...
0
votes
2answers
220 views
arrays format (Javascript)
I have a list of users, with minions, something like this:
User52:
minion10
minion12
User32:
minion13
minion11
I've been keeping in an array where the "location" is the ...
5
votes
8answers
4k views
What is the difference between an Array and a Stack?
According to Wikipedia, a stack:
is a last in, first out (LIFO) abstract data type and linear data structure.
While an array:
is a data structure consisting of a collection of elements ...
4
votes
6answers
631 views
why are both index[array] and array[index] valid in C?
For example consider:
int index = 3;
int array[4] = {0, 1, 2, 3};
then both index[array] and array[index] are valid expressions, much like *(index + array) and *(array + index).
In C arrays why is ...
5
votes
1answer
374 views
How to remove the boundary effects arising due to zero padding in scipy/numpy fft?
I have made a python code to smoothen a given signal using the Weierstrass transform, which is basically the convolution of a normalised gaussian with a signal.
The code is as follows:
#Importing ...
1
vote
1answer
246 views
Is there a more efficient way to filter large arrays than preg_match()?
I have a log that our web application builds. Each month it contains around 16,000 entries of a string with about the average sentence worth of text.
To filter/search through these in our admin panel ...
0
votes
2answers
781 views
Subscript binding and array categories
I am learning "Programming languages principles" and there is a lot of information about stuff which make up a programming language . Unfortunately every material I came across until now has a lot of ...
0
votes
4answers
853 views
What is the easiest way of viewing an RGB byte array as an image? [closed]
I have a byte array stored in a file. I want the quickest, easiest way of viewing the image whether it is writing code or using a utility or web page.
6
votes
3answers
1k views
Ordered enumeration: IEnumerable or Array (in C#)?
Typical context: I make an extension method for a collection which considers that the elements are ordered. The function starts at the beginning, at index 0, and the order has significance. Examples: ...
0
votes
2answers
4k views
Best practice Java - String array constant and indexing it
For string constants its usual to use a class with final String values. But whats the best practice for storing string array. I want to store different categories in a constant array and everytime a ...
2
votes
4answers
263 views
Algorithm design for comparing split times in a race
I need to determine the ranking of values in an array without altering their position, so that I can print the position of each split time next to the actual value of the split time in a table like ...
1
vote
6answers
790 views
Why isn't the line count in Visual Studio zero-based?
This just struck me as an oversight by Microsoft. Since arrays and other data-structures within the .NET framework begin from zero (zero-based) why don't we have a line 0 within the code view in ...
1
vote
3answers
344 views
What are pros and cons of using temporary “references”?
In C and C++ (and I guess other languages that allow taking a "reference" to an array element or something similar), when you have an array like type, accessing individual elements of such an array ...
3
votes
3answers
583 views
Lisp: Benefits of lists as code over arrays as code?
Question for lisp programmers:
Lisp code is lisp data, usually lists. Is there an advantage to code being lists over code being arrays?
Would macros be easier to write/faster to run?
You can ...