Questions for arrays


Reversing a sub-array of an array , in less than O(n) time

how can we reverse a subarray ( say from i-th index to j-th index ) of an array ( or any other data structure , like linked-list ( not doubly )), in less than O(n) time ? the O(n) time consumption is

splitting multi-line email address entries

I'm having problems with splitting an array correctly. I have a textarea input that allows for multiple email addresses to be entered one per line. Once entered I'm turning this into an array and ...

Creating a generic array instance in a generic method

I'm trying to build a helper method to turn the two line list to array conversion into a single line. The problem I've ran into is that I'm not sure how to create a a T[] instance.

Getting back specific lower bounds value from inputted key in LinkedHashMap

I have an LinkedHashMap that uses the values from a char array as its key adds integers 1 to the size of the char array as its values:

Add values to an array after isset()

I'm trying to add elements to an array after subsequent trials, but so far only one value is being added to the array. I've Googled and searched stackoverflow, and I seem to be getting only half the

extract some html with preg_match

i use preg_mach for extract some html ( i try to use DOMDocument but i had some problem with new line )

Array index out of bounds

I don't know what I'm missing... the full code is pretty big so I'll just put the part throwing exceptions here.

Erasing a Char

Okay i am working on someone elses code. They do alot of this:

Is it advisable to use arrays in Javascript using tens of thousands of indexes?

Is it advisable to use arrays in Javascript using tens of thousands of indexes?

Combine all elements of two arrays python

I have two arrays, and want to combine the ith elements in each one together:

Convert jquery selectors to array

I need to be able to store the current selectors in the current viewport and then 10 seconds check if they are still in the users current viewport.

Reading file into char array in C: Or how to dynamically allocate an array?

Using Linux system calls open and read. The read call accepts 3 parameters

How to Pass Array from One Servlet to Another Servlet?

I want to pass multiple values from one servlet to another one servlet. Please tell me how to pass that?

Java Double Array

I'm having trouble setting up and placing values into an array using a text file containing the floating point numbers 2.1 and 4.3 each number is separated by a space - below is the error I'm getti...

Can't correct my java program

I just started learning java and I'm working on a program. I'm getting an error here:

awk issue (return an array from user defined function)

I have this function (converting coordinate of an WGS84 geoid to cartesian coordinates...doesn't matter):

Adding a specific range of numbers to an array

I have been looking and looking at my code and I still can't figure out why the result is always the highestGrade value and not a different value for every position in the array.

JS: Can not convert to object, childNodes related

Ok, feeling stupid here, but wondering what the problem is here exactly.

Passing int array to fragment shader

I'm attempting to plot an iterative function in OpenGL ES. An array of ints is being updated with how often a given pixel is hit by the iterative function. I'd like to pass this density array to a

PHP multidimensional array key value

I am working with multidimensional arrays;

shipping boxes sizes find largest side and smallest size

I am doing some shipping calculations. I need some help trying to figure this out.

Deleting duplicates in an array (C++)

I saw an older post on here asking how to do relatively the same thing, but their approach was different and i'm interested to know the hole in my program.

Reorder objects

What is the best way to order and transform:

count() not returning correct number of array elements

I have two arrays (records returned from a database query) that I'm merging. I then need to get a count of the elements in the combined array.

Best way to search through an array and return result

I have an application where you can add peoples firstname, lastname and phonenumber (eg. "new Member('Thomas', 'Jonsson', '0709454543'"). In the application it's possible to show the members on a web

GSON (or) JSON to contentvalues with array of arrays

I am trying to get a fusiontables sql response into an sqlite db in android. says the object is valid JSON. But, the arrays in "rows" are not recognized as JsonArrays or JSONArrays. ...

Comparing output to a list/array

I consider myself a very beginner at python(and programming in general!), but I am working though "learn python the hard way" by Zed A Shaw and slowing picking things up.

How do you link two arrays?

I'm in a basic programming class, and everything is done in pseudo code.

Swap elements in array to reverse an array

I got an assignment to reverse an dynamic array in C++. So far, from my logic, I thinking of loop thru the array to reverse it. And here comes my code :

Read char from txt file in C++

I have a program that will read the number of rows and columns from a txt file. Also, the program has to read the contents of a 2D array from the same file.

How do I separate a comma delimited variable into multiple variables?

This is probably very elementary, but I'm still learning.

Can you make sense of this C pointer code?

I have this snippet of C code that uses pointers in a very confusing way.

jQuery to count over images in a div and tell me what image I am currently viewing based on z-index and title attr

I'm working with the Orbit jQuery slider. Tricky thing is that I am running six iterations of that slider on the page. What I want it to do is tell me I am on image 4 of 7, 5 of 7, etc...

Using a string to generate a byte array of data from a lookup table

I have this program that is reading the test string from a textbox and convert it to a byte array that makeup data to be diplayed on a screen. I am getting very close. The code can currently pull the

matlab Is there something like list comprehension as it is in python?

I am looking for something like list comprehensions in matlab however I couldnt find anything like this in the documentary.

How to store a byte array in Javascript

I'm going to be storing a large array of byte values (most likely over a million) in Javascript. If I use a normal array with normal numbers, that will take 8 MB, because numbers are stored as IEEE

Reversing a part of an array (or any other data structure )

I want to reverse an array (or any other data structure) but because this operation is going to be done on the array for n times , im looking for the best solution possible, I have the sorted arra...

Sort mixed alpha/numeric array

I have a mixed array that i need to sort by alphabet and then by digit

Find max sum of elements in array

Write a program which by given array of integer values (containing negative integers) finds the maximum sum of successive elements in the array.

jQuery help - Parse XML into array

I am currently developing a HTML game whereby a user drags items and drops them into their correct categories. The categories and their items are defined in an XML document.

Retrieving values from a PHP Multi-dimensional Array

I have a multi-dimensional array that I want to print statistics from for a website admin. My problem is that once I get the data into an array in the format I want it, I can't figure out how to re...

How should I pass an array by value? Isn't Clone() discouraged?

I've been debugging a C# program of mine, and after several fruitless spans of time, discovered the error came from "accidentally" passing an array by reference instead of by value.

How to convert char to char[40]

Usually I do strcpy but here is looking like I can't copy bigger-sized to lower-sized array. I understand that I need to skip an array element for it, I want to skip first [0] element but how can I...

jQuery / javascript find values within a list

I have a peculiar issue I'm dealing with. I'll start off vague and if anyone needs more detail I can give background on the project.

Best way to combine 2 hashes in this order

I have 2 hashes list1 and list2. Keys are user ids. Here is an example

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.