Given a Sorted Array which can be rotated find an Element in it in minimum Time Complexity.
eg : Array contents can be [8, 1, 2, 3, 4, 5]. Assume you search 8 in it.
What is the best way to touch two following values in an numpy array?
example:
npdata = np.array([13,15,20,25])
for i in range( len(npdata) ):
print npdata[i] - npdata[i+1]
this looks really messed up and additionally needs exception code for the last iteration of the loop.
any ideas?
Thanks!
how to get a list of files / folders as an IEnumerable and not an array?
the reason I want to do this is a have many folders with 20,000+ files in them, and i need to loop through all of them but do not want to wait for them to be compiled into an array. but just want to go through one at a time.
also i'm using .net 3.5 not v4
i am Reading the file contents and passed it in explod function("=",$string) ,it gives me two array parts[0].parts[1] seprated by = .parts[1] array displays all the values of the variable .now how can i use these values one by one to pass in the text box .The variable value comes in this way (value1
value2
value3
value4...)
my code also throws the undefined offset :1 notice when i prints the parts[1]arrray
Kick me if I'm being silly but some some reason I'm having a heck of time building a dynamic array in magento.
Example:
$data = array();
$data[0] = 'test';
$data[1] = 'what';
I keep getting an ERROR:
Notice: Undefined offset: 0
Any ideas?
Do I need to handle these arrays differently since they are in a class?
Hello
i m using zend by some code i succeeded to populate array on values to a phtml form but now iwant to post this array of values from html form to controller.
How it is possible?
Thanks.
Hello guYz plz help me out in making it possible to open the files by the adress provided in an array of strings.........
a way to open file is as given below...
ifstream infile;
infile.open("d:\aslam.txt");
but how can i open file providing an array of string as an adress of file.....
like this
infile.open(arr[i]); (but its not working)
plz help me.........
How do I set up a OnClickListener to simply tell me which index button was pressed from an array of buttons. I can change text and color of these buttons using the array. I set them up like this.
TButton[1] = (Button)findViewById(R.id.Button01);
TButton[2] = (Button)findViewById(R.id.Button02);
TButton[3] = (Button)findViewById(R.id.Button03);
up to 36.
Hi,
I am using C#.
I have an array of size 10. I want to pass it to a function, but only from the second element. In C, this is how I would implement it
myfunc( myarray + 1 )
Effectively I am virtually shifting the array / deleting the first element.
How do I implement this in C# ?
I have an associative array in JSON
var dictionary = {"cats":[1,2,37,38,40,32,33,35,39,36], "dogs", [4,5,6,3,2]};
Can I get the keys from this? I tried in Visual studio putting a breakpoint but can't see any property that represents keys. Is it not possible?
I'm fine creating a separate array if necessary, but was just hoping it wasnt :
var keys = ["cats", "dogs"];
my attempt to init an array with a number of bool values using:
[myArray initWithObjects:[NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES],
[NSNumber numberWithBool:YES],
nil];
seems to fail since the debugger shows an empty array after this statement is carried out ... Any clues?
How can I pass an array of struct by reference ?
example :
struct Coordinate {
int X;
int Y;
};
SomeMethod(Coordinate *Coordinates[]){
//Do Something with the array
}
int main(){
Coordinate Coordinates[10];
SomeMethod(&Coordinates);
}
hi
i am using an array of file, i mean input type ="file" to upload number of files at a time.
i want to print or echo that file array values , how can i do this.
please help me
Thanks
okay, C++ and java i have no problem learning or what so ever
when it comes to mips it is like hell
okay i wanna learn how to read in the an array and print all the element out
here is a simple array that i wrote
int[] a = new int[20];
for(int i=0; i
for(int j=0; j
how do you do it in mips
I have a simple one level deep vocabulary taxonomy. Something like Vocabulary-Term-Node. What I want to know is if there's a built in function to get an array of nodes related to a single term, something like taxonomy_select_nodes() but that would return an array of nodes instead of a string.
Hi,
I am using the Cocoa JSON framework ( http://code.google.com/p/json-framework/ ) to communicate with an API.
The problem is that the API returns a dictionary if there is an error but returns an array of the results if it works.
Is there a good way to detect if the JSONValue is an array or a dictionary?
Thanks.
Im trying to achieve an output like this
{"status":"ok","0":{"id":"11","title":"digg","url":"http://www.digg.com"}}
but instead i am getting this
{"status":"ok","0":{"id":"11","title":"digg","url":"http:\/\/www.digg.com"}}
this is the php code im using to generate the json
$links = array('id'=>'11','title'=>'digg','url'=>"http://www.digg.com");
$msg = array('status'=>'ok',$links);
echo json_encode($msg);
any idea what is causing this?
iam having an array of items like
[item1,itmem2,item3];
i have to insert these items at a particular userId:
final results look like this
UserId ItemId
2 || item1
2 || item2
2 || item3
currently iam looping through the array in php code and inserting each item one by one eg
foreach($items as $item)
{
insert into items (UserId,ItemId) value (2,$item);
}
is it possible i can insert all entries in single query.
I am messing around with assembly for the first time, and can't seem to change the index values of an array. Here's the method I am working on
int ascending_sort( char arrayOfLetters[], int arraySize )
{
char temp;
__asm
{
//???
}
}
And these are what I tried
mov temp, 'X'
mov al, temp
mov arrayOfLetters[0], al
And this gave me an error C2415: improper operand type
so I tried
mov temp, 'X'
mov al, temp
mov BYTE PTR arrayOfLetters[0], al
This complied, but it didn't change the array...
When I have a JavaScript array like this:
var member = {
"mother": {
"name" : "Mary",
"age" : "48"
},
"father": {
"name" : "Bill",
"age" : "50"
},
"brother": {
"name" : "Alex",
"age" : "28"
}
}
How to count objects in this array?!I mean how to get a counting result 3, because there're only 3 objects inside: mother, father, brother?!
I manage to pass the following array from MessagesTableViewController.m to arraySelectedCategory in another class called MessageDetailViewController.m:
self.messageDetailViewController.arraySelectedCategory =
[[NSMutableArray alloc] initWithObjects:@"Value 1",@"Value 2", @"Value 3", nil];
but how do I hand over an array stored in: NSMutableArray *categories;
self.messageDetailViewController.arraySelectedCategory = ?????
Thanks!
I know the center (x,y) coordinates of a subarray in terms of the subarray space and general array. For other parts of the subarray I also know the coordinates in the subarray space - but I want to find the coordinates in the general array? Is there an elegant way to do it in Matlab?