Questions tagged [contiguous]

145 questions
3
votes
1 answer

What kind of iterators supports random access but not contiguous storage in C++?

I saw that there is a new iterator since C++17,below listed by a screenshot in cppreference. I was a lot confused. What kind of iterators is random access but not contiguous storage in C++?? otherwise, the ContiguousIterator is not powerful than …
Andy Cong
  • 109
  • 1
  • 10
3
votes
1 answer

Finding ContiguousCount of items in list?

Given a list: >>> l = ['x', 'x', 'y', 'y', 'x'] I could get the count of the list by using collections.Counter: >>> from collections import Counter >>> Counter(l) Counter({'x': 3, 'y': 2}) How can I count contiguous items instead of the global…
alvas
  • 115,346
  • 109
  • 446
  • 738
3
votes
1 answer

Pass a string with multiple contiguous spaces as a parameter to a jar file using Windows command prompt called from a java program

I want to pass a string with multiple contiguous spaces as a parameter to a jar file using Windows command prompt called in another java program. The java file is something like this which prints all of its arguments: package src; public class…
Diamond
  • 598
  • 5
  • 15
3
votes
2 answers

Contiguous storage containers and move semantics

How can a container be both contiguous and support move semantics at the same time? An example with std::vector: When push_back() is called using std::move on an lvalue: std::vector v; MyClass obj; MyClass…
3
votes
1 answer

Writing a file to contiguous memory blocks

I'm writing 100 MB files to a disk with ext4 filesystem continually, and when the disk is full, I just delete the oldest file and write the new one. The files never grow in side. When I do this the file system becomes quiet fragmented after some…
3
votes
5 answers

Determine if a sorted array contains a contiguous sequence that sums up to N

I'm trying to write an algorithm that will return True/False whether a contiguous sequence in a sorted array that contains only positive integers, can sum up to N. For example: Array = { 1, 2, 3, 4 }; 6 is good! 1 + 2 + 3 = 6 8 is not good! 1 + 3 +…
Novak
  • 2,760
  • 9
  • 42
  • 63
3
votes
3 answers

T-SQL to create an ID column

I'm using SQL Server 2008 R2 and I have the following dataset: +---------+--------------+--------------+----------+------------+------------+ | Dossier | refmouvement | refadmission | refunite | datedeb | datefin …
3
votes
2 answers

Dynamic 2d Array non contiguous memory c++

Say I passed the address of the 2d array to a function along with its row and column of the 2d array. The function will treat the address of the 2d array as 1d array. (eg. int matrix[] ) If i execute below code: int** arr; arr = new…
whiteSkar
  • 1,614
  • 2
  • 17
  • 30
3
votes
2 answers

MySQL maximum contiguous count query

Does anyone know how to get the maximum sequence count from each column in a table. For example if have table A which has the following data id | n1 | n2 | n3 | n4 | n5 | n6 | n7 | n8 | n9 | n10| Max |…
2
votes
2 answers

Java: Contiguous region in a multi-dimensional array, used to implement a Latin Square

I am writing a program that reads in a potential Latin Square and tells whether or not it is a valid latin square or not. Now I am trying tell if the region selected is a contiguous one or not. The potential Latin Square and the location of the…
2
votes
3 answers

Are C++ Vectors always contiguous?

Possible Duplicate: Are std::vector elements guaranteed to be contiguous? I have come across a technique in which people use a vector in C++ to receive or send data for MPI operations as it is said to store elements contiguously in…
cpp_noname
  • 2,031
  • 3
  • 17
  • 30
2
votes
3 answers

Allocating dynamic array of structs with dynamic arrays in C

I am trying to allocate an array of structs, with each struct also containing dynamic arrays. They will later be communicated via MPI_Sendrecv: struct cell { double a, b, c, *aa, *bb; } *Send_l, *Send_r; I want Send_l and Send_r to have count…
BlubMan
  • 23
  • 4
2
votes
5 answers

Get all blocks of contiguous same numbers for an array

I have an array here int arr[] = { 2, 6, 6, 3, -1, -1, -1, 4, -1, -1, 5, 5, -1, 7 }; // ^^^^^^^^^^ ^^^^^^ and I want to write a code that gets the number of blocks of contiguous -1s in the array but only the ones that…
ahmadalibin
  • 133
  • 8
2
votes
0 answers

Maximal contiguous subarray with at most K elements

Is there a way to find in O(N) complexity, a maximal contiguous subarray with at most K elements. Or there isn't such a possibility. for example: A = [4, -2, 6, 4, -2, 6] K = 3 because 6 and 4 in the middle are equal to 10, the function should…
Avraham
  • 61
  • 1
  • 4
2
votes
1 answer

When are arrays C-contiguous and F-contiguous simultaneously?

Under what conditions can arrays be C-contiguous and F-contiguous simultaneosly? I can think of the following: The 1D case that is trivially C- and F-contiguous. Similarly, multi-dimensional arrays where all dimensions are singleton dimensions…
ARF
  • 7,420
  • 8
  • 45
  • 72
1 2
3
9 10