The array tag has no wiki summary.
0
votes
0answers
61 views
Arrays vs Objects in view template
I am wondering, in view templates, what would contribute to me choosing between using arrays or objects for getting things printed out in arrays
{{$user->zip_code}} vs {{$user['zip_code']}}
I'm ...
-1
votes
0answers
34 views
Array sum of difference of first smallest k elment [on hold]
Hi i come across this challenge on an online programing challange the task is so simple for ex
WE have to variable N and K where N is where N is lenght of array and we have to find sum of ...
-1
votes
0answers
55 views
Vector with Constant-Time Remove - still a Vector?
One of the drawbacks of most common implementations of the Vector class (or ArrayList, etc. Basically any array-backed expandable list class) is that their remove() operation generally operates in ...
-2
votes
0answers
32 views
Create an array from mysql with column names and values [closed]
i'm trying to create an array with PHP and MySQL, but i always get errors.
The code i'm using
function db_listar_usuarios(){
$link=db_connect();
$query = "select * from usuarios" or die("Problemas ...
0
votes
5answers
186 views
Is it considered bad practice to access a returned array by a key straight away?
I couldn't think of a good way to word the title, sorry. But what I mean is, is it considered bad practice to do:
print get_array()[2]
over:
output=get_array()
print output[2]
(where get_array() ...
-1
votes
3answers
92 views
Find all lines segments intersections
I have a collection of lines segments, represented by an array.
Ex: [3,7,13,6,9] is 4 line segments: [(3,7)(7,13)] , [(7,13)(13,6)] , [(13,6)(6,9)] , ([6,9)(9,3)]
I want to find all the lines ...
0
votes
5answers
511 views
Reverse subarray of an array with O(1)
I have an idea how to implement sub array reverse with O(1), not including precalculation such as reading the input. I will have many reverse operations, and I can't use the trivial solution of O(N).
...
0
votes
0answers
16 views
Java Grade Calculator program for class kepp geting the error “Exception in thread ”main“ java.lang.ArrayIndexOutOfBoundsException.” [migrated]
this is my first question I've posted. I've used this site to look at other questions to help with similar problems I've had. After some cursory looking I couldn't find quite the answer I was looking ...
0
votes
0answers
11 views
perl comparing 2 data file as array 2D for finding match one to one [migrated]
I'm doing a program that uses combinations of variables ( combiData.txt 63 rows x different number of columns) for analysing a data table ( j1j2_1.csv, 1000filas x 19 columns ) , to choose how many ...
3
votes
2answers
158 views
What would be the optimal way to solve a problem like this?
I have a problem where I have to change all the Xs in a 2D array into 0s, and I have to calculate the minimum steps (where a single step consists of changing an entire row or column) required to do ...
2
votes
3answers
210 views
What language has integrated “list insertion” as part of code *syntax*?
Many programming languages permit natural manipulation of strings, and some languages permit the manipulations of lists too.
More often then not (always?), these operations are done as procedure ...
2
votes
6answers
309 views
Settle an Argument: String vs. Array?
True or False: A string is the same thing as an array.
I had an interview the other day and the above question was asked. I said false, but the interviewer said it was actually true. I explained to ...
0
votes
1answer
66 views
Use ruby's array sort() method, or add items in correct place with a binary lookup?
If I am loading a whole load of items (un-ordered words from a file or something) would it be more efficient to load them all to a Ruby array, and then use the built in sort! method or to do a binary ...
0
votes
1answer
129 views
Sort rectangles in a grid based on a comparison of the center point of each
If I have a grid of rectangles and I move one of the rectangles, say above and to the left of another rectangle, how would I resort the rectangles?
Note the rectangles are in an array, so each ...
3
votes
2answers
340 views
CA1819: Properties should not return arrays. Does this happen only with arrays? If yes, why?
I have a question about CA1819 msdn performance warning.
The rule is: Arrays returned by properties are not write-protected, even if the property is read-only. To keep the array tamper-proof, the ...