Re: Sub Array Programming Software Development by menonnik for eg. if we need to find a sub array such that the (sum of the sub array) mod b is atleast equal to k, then what are the sort of functions that we can use? Sub Array Programming Software Development by menonnik How can we find a sub array in a 1-D array? Is there any other method other than brute force method? It is not for maximum sum so we can't use kadane's algorithm. Re: Sub Array Programming Software Development by Ancient Dragon what kind of an array are you talking about? use strchr() or strstr() with character arrays. Re: Sub Array Programming Software Development by menonnik an array with numbers. Re: Sub Array Programming Software Development by TrustyTony Are all values positive, if not bow you define modulo for negative values? How many values there are in array? How big is b, how is range of values, are they random or for example typically small? Re: Sub Array Programming Software Development by menonnik the values are positive. there can be around 50 values in the array. b can be anything between 1 and 1000000. But i'm looking for a general algorithm that can be used for all functions not for this one specifically. Random selection from array as sub array Programming Software Development by torkolort … was to take a random selection from it into an array and pass it to a class extending the AbstractTableModel. Then… char and string arrays. The idea was to create a sub array from these with a random selection (5 characters and 5… strings). But I struggle with the creation of a random array. I figured I could use the Collections.shuffle and then… How to find length of sub-array Programming Software Development by subith86 … (4, in this case). now sub_b is the sub-array of b at row 1, which is {-3,0} Is … Re: Sub Array Programming Software Development by Narue Most of the fast string searching algorithms can be applied to non-string arrays as well. Re: Sub Array Programming Software Development by menonnik But I'm not not searching. I want to perform some operation on the subsets.(which is not sum) So how will string search algorithms help me? I looked up one algortihm Boyer-Moore algorithm but it's not of any help. Re: Sub Array Programming Software Development by TrustyTony That is really dependent of the nature of function applied and if there is overlap with previous answers and recursive function, you can sometimes reverse it to build dynamic programming solution or if it is difficult use memoized recursive function. I have recently done some subrange sums, but not in C. array problems Programming Software Development by dflatt …. [CODE] typedef int* ptr; ptr sub;//dynamic int count = end - start; //the sub-array's size is not "end"… (count <= 0) //check that you actually have a sub-array to create. return 0; //here, your function has no return…i<end; i++) { int j = 0; sub[j] = Array[i]; cout<<sub[j]<<", "; j++; } for… Re: array problems Programming Software Development by Fbody …] instead of the relevant element of the "sub-array". Another option is to declare j "static". … Re: array problems Programming Software Development by dflatt …] instead of the relevant element of the "sub-array". Another option is to declare j "static". … Re: Array within an array Programming Web Development by Fest3er …2" => "two"); $b = array("a" => "aye", &…array("a scalar", $a, $b); // Extract a sub-element from an array in the array $d = $c[1][2]; // Extract a sub-array… from the array $e = … Re: Array inside $_POST Programming Web Development by josephe Thank you for your quick response, Will! I'm familiar with count() (still new to me), but I still don't know how to extract the sub array label out of $_POST, so I can count it's items. Any help with that so I can count it afterwards? Sorting a char array in c++ using pointers Programming Software Development by unsensible …to the smallest element so far in // the sub-array. // scan rest of sub-array looking for smallest element. for (char i=1… 0. // Swap smallest element in sub-array with first element in // sub-array. i.e. element array[j] of entire array. swap(smallptr, p); } }… file to array question Programming Software Development by demroth … file to a larger unsorted array and then move specific elements from that array to specific sub arrays. I can write the…; //places the elements from the input_array into the correct sub array depending on what range of integers it falls between for…; i <<" will not fit in a sub array" <<endl; } } [/code] popping numbers from an array...to make it sorted Programming Software Development by gregorynoob … the minimum numbers to be popped from an array to make it sorted. so for example 12534756… last indexes of the sub-array. so i'd give 0 to all sub-arrays of length 1 …the table but adding the values of two sub-arrays of a larger one resulted with huge…0] the bracketed zeros are the ones with sub-array length 1.. the table actually gives the right … Re: popping numbers from an array...to make it sorted Programming Software Development by VernonDozier … the minimum numbers to be popped from an array to make it sorted. so for example 12534756… last indexes of the sub-array. so i'd give 0 to all sub-arrays of length 1 …the table but adding the values of two sub-arrays of a larger one resulted with huge…0] the bracketed zeros are the ones with sub-array length 1.. the table actually gives the right … Re: file to array question Programming Software Development by Sky Diploma Hey I donot understand Why you actually need the second loop. I prefer to do this 1)initialise all elements of your subarrays to '0' 2)Remove the second for loop 3)After finding the limit in which the value can be assigned in , Search for a zero in the sub array and then give it the value Hope this makes sense. Re: Getting specific key from array without looping Programming Web Development by Fernando_4 … car will have it's own `['ico']` sub-array and that's why the number of icons …each car block will take as a parameter the corresponding sub-array `myArray` like so: createCarBlock($myMainArray['myArrayForCar1']); function createCarBlock… where i need the keys } So each sub-array has a variable number of items depending on what… Search within an Array and add more content Programming Web Development by mbarandao …2498' [marker] => '<-----CLUB DATA ENDS ----->' ) [1] => Array ( [cName] => 'Table Tennis Club of Louisville (3/31/2014… ) ) I would like to look inside each sub array with keys [0] and [1] for the sub-array [local]. Now inside the value of… Extra parameter in call to function w/2d array Programming Software Development by jessekoegler … to compute the variance of a subarray from a main array -- arraym.I keep getting an extra parameter in call error…? minl and minw are the starting sub-array offsets and rlm and rwm are the ending sub-array offsets. Everything else is declared correctly… Re: Search within an Array and add more content Programming Web Development by mbarandao cereal, Great stuff! works great and as expected. I appreciate that! How would I grab the state 2 characters and create a sub array as well. I just realize that I will need that as well. Sorry for not mentioning in the initial post. Getting specific key from array without looping Programming Web Development by Fernando_4 … I'm trying to get the key's of each sub-array that I will need at this part of the script… go about doing this? My only concern is that the array may grow with time and I'm wasting memory just… academic purposes, lets belive I have no control over the array creation so changing the key at the start isn't… Re: Getting specific key from array without looping Programming Web Development by Fernando_4 … and there might be more or less icons in that sub-array and that's where the key's will change. The… Re: Random selection from array as sub array Programming Software Development by JamesCherrill If you are just selecting 5 random elements from a collection of 26 then frankly you are wasting your time worrying about efficiency, either for CPU or memory. Maybe with optimal coding you could save a microsecond of CPU, and a few hundred bytes of temporary memory. Unless you plan to do this millions of times in rapid succession you can safely … Re: Assigning values to a multidimensional array Programming Software Development by mike_2000_17 … struct local_sub_array { T data[4][3]; }; // create your static const sub-array: static const local_sub_array rhs = {{{4,2,6},{4,5,2… struct local_sub_array { T data[4][3]; }; // create your static const sub-array: static const local_sub_array rhs = {{{4,2,6},{4,5,2… Re: need some array help Programming Software Development by KBL …that goes into the status array to set the number in the sub array from 1 to 6. if…names: array[1..6] of string; status: array[1..6] of string; country: array[1..6] of string; sub: array[1..6… participant(status[index]) in[1..6] then readln(sub[index])=400; end; begin write('Enter country of origin…