The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
159 views

What is the name of this array transformation?

Start with an array of arrays; in this case, they are different lengths in order to demonstrate the technique, but they do not have to be. [[1,2,3,4], [5,6,7], [8,9,10], [11,12,13,14,15]] At the ...
4
votes
2answers
811 views

Array Multiplication and Division

I came across a question that (eventually) landed me wondering about array arithmetic. I'm thinking specifically in Ruby, but I think the concepts are language independent. So, addition and ...
2
votes
1answer
120 views

Handling Dynamic amount of Strings for persistent and runtime storage in an IOS App

Background I am dynamically building an FQL query statement and because of the nature of the app, I exclude FB family members, this is the base portion of the query and remains fairly static. The ...
0
votes
1answer
1k 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 ...
4
votes
2answers
585 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
2k 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
4answers
1k 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
780 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
324 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 ...
3
votes
1answer
667 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
314 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 ...
4
votes
5answers
567 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; ...
5
votes
4answers
46k 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
911 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
868 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
756 views

Should the 12-String be in its 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
348 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
421 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
899 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
573 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
4answers
15k 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 ...
1
vote
2answers
596 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 ...
3
votes
3answers
2k 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
439 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 ...
7
votes
8answers
11k 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 ...
5
votes
6answers
889 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 ...
6
votes
2answers
849 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
477 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
2k 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
2k 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
2k 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
7k 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
393 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 ...
3
votes
6answers
931 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 ...
2
votes
3answers
534 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 ...
4
votes
3answers
878 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 ...
0
votes
2answers
819 views

Question regarding LinkedList in Java

When I was reading a book for SCJP, I came across the following paragraph. A LinkedList is ordered by index position, like ArrayList, except that the elements are doubly-linked to one another. ...