Questions tagged [contiguous]

145 questions
0
votes
1 answer

How to create threads in c with contiguous ids?

I am trying to create threads in C that have contiguous id numbers. For example let us say I want to create 10 threads, then I want to give them the id's 1 through 10. Later on, I want to be able to access these id's and print them out from the…
Omar Hijazi
  • 95
  • 1
  • 6
0
votes
1 answer

Counting Cells Non-Contiguously

I'm not entirely sure how to express what I am attempting to do, but I will do the best I can. I'm wanting to count non-contiguous cells in Excel in the order which they are clicked. For instance, lets say that column A has a drop down and I want…
c.wendel
  • 3
  • 2
0
votes
0 answers

Finding non-continuous numbers in an array

I was wondering if you had a column like [8 8 8 8 8 1 4 4 4 1 1]' What code could I write to find the numbers that are not repeated consecutively (non-contiguous)? In this case, what code would I have to write to find row 6? This is for big…
0
votes
2 answers

Declare global contiguous 2d array at runtime. The dimensions are unknown at compile time C

I want to declare a global 2d array in C, and allocate contiguous memory at runtime because the minor dimension is unknown at compile time. I would like to dereference the array with 2-indices notation A[i][j]. If the array wasn't global c99…
NickSar68
  • 55
  • 5
0
votes
1 answer

What happens to memory behind the scenes when creating new objects inside of C# for loops?

I'm trying to understand when memory gets allocated and when the garbage collector collects garbage. Let's say that I have some code like this: foreach (FileInfo f in File){ foreach (DataAtrribute d in f){ string name = d.name; …
0
votes
2 answers

Using bash to create random contiguous number sequences from a given range

Using a given range of values, I'm trying to generate random instances of three contiguous numbers. For example, given the range 1-100, and desiring three (non-overlapping) random instances of three contiguous numbers, the output would be something…
aaron
  • 3
  • 2
0
votes
1 answer

Find all contiguous subsequences of an array of sum k

Example: The array is as follows: -4 -10 -15 - 20 100 -67 47 20 and k = 51 Expected output: -4 -10 -15 - 20 100 -4 -10 -15 - 20 100 -67 47 20 Tried the brute force solution with O(n^2). Can anyone please suggest a better solution to this?
Pooja N Babu
  • 347
  • 3
  • 5
  • 15
0
votes
1 answer

Maximum contigous subsequence sum of x elements

So I came up with a question that I've looked and searched but with no answer found... What's the best (and by saying the best, I mean the fastest) way to get the maximum contigous subsequence sum of x elements? Imagine that I've: A[] = {2, 4, 1,…
0
votes
2 answers

Select only Contiguous Records in DB2 SQL

So i have a table of readings (heavily simplified version below) - sometimes there is a break in the reading history (see the record i have flagged as N) - The 'From Read' should always match a previous 'To Read' or the 'To Read' should always match…
JungleJme
  • 21
  • 4
0
votes
1 answer

How can implement a C++ vector that points to other, multiply typed vectors?

I want to store elements of multiple types in a single vector, while keeping elements of the same type contiguous. The types are derived from a base class and I expect different types to be implemented throughout the development cycle. For this…
0
votes
2 answers

ContiguousArrayStorage does not implement methodSignatureForSelector

I get this warning: *** NSForwarding: warning: object 0x3560018 of class '_TtCSs23_ContiguousArrayStorage0000000017DB45E4' does not implement methodSignatureForSelector: -- trouble ahead Followed by an error [SwiftObject…
calicode
  • 237
  • 3
  • 10
0
votes
0 answers

Dependent, Non-Contiguous, Dynamic Named Range in Data Validation

In Excel 2010, I have a formula that works like this: =OFFSET(OFFSET(Table!$E$8,0,0,1,1),MATCH(Criteria1!$C9&Criteria2!$D9,Plan[Wirecentre]&Plan[Type],0)-1,0,COUNTIFS(Table[Criteria1Range],Criteria1!$C9,Table[Criteria2Range],Criteria2!$D9)) Let's…
0
votes
1 answer

Longest Common Contiguous Substring Length in C

So the following is the code I wrote up for the algorithm. I cannot find what is wrong with it. The test cases are supposed to yield 12, 4, and 3 respectively but instead yield 8, 1, and 2 respectively. Did I misunderstand the algorithm…
0
votes
1 answer

Count fragments or sequence of contiguous numbers in an array

Say you have an array of integers, eg: [0,1,2, 5,6,7, 9,10,11]. In an ideal world they would be sorted, but if the algorithm can work with unsorted, even better. I need to know how many "fragments" are in this group. Imagine the array makes up an…
Nick
  • 2,803
  • 1
  • 39
  • 59
0
votes
1 answer

Allocate data in nested STL vectors contigously

I want to store a 3-dimensional matrix in a way that all the data is contiguous. This is because I need to send the matrix to a master node using MPI, and then concantenate all the smaller matrices into one big matrix. This becomes cumbersome with a…
Filip S.
  • 1,514
  • 3
  • 19
  • 40
1 2 3
9
10