Tagged Questions

An array is a data structure consisting of a collection of elements (values or variables), each identified by at least one index. All the elements of an array are stored adjacent to each other.

learn more… | top users | synonyms

-1
votes
1answer
23 views

Compare Arrays in Dice game [closed]

I found an open source project that has a few bugs (I have fixed a couple so far) but this one has me stumped. The issue that I am trying to solve... If I have 3 sets of pairs (isThreePair) and it ...
4
votes
1answer
47 views

A blocking buffer manager to provide segments of a byte array

Since asynchronous operations (like Socket's Begin*-End* pairs and *Async methods) that use IOCP under the hood cause the byte array that you use as buffer to be pinned in the memory. So if you ...
4
votes
1answer
30 views

Sparse Bitarray Class in Python (or rather frequently having contiguous elements with the same value)

Sparse is probably the wrong word - this is for encoding arrays of booleans where contiguous values tend to be the same. It'd be great to know a proper name for this data structure so I could read ...
4
votes
1answer
71 views

Partitioning Array

Problem: Given a randomly ordered array of n-elements, partition the elements into two subsets such that elements <=x are in one subset and elements > x are in the other subset. one way to do this ...
4
votes
3answers
106 views

Is my code dealing with the presented problem the right way?

I finished this program to print a 2D array, I got the right output, but I'm not sure if I did what was being asked in the problem below. My code to deal with the presented problem: package ...
4
votes
3answers
108 views

A simple array-based Stack class in Java, what are my mistakes?

I have created a simple array-based Stack class with some methods like the actual Stack in Java. I am testing this for mistakes, but since I am learning Java and my tests may not be as comprehensive ...
4
votes
2answers
119 views

A simple ArrayList class in Java, what are my mistakes?

I have created a simple ArrayList with some methods from the actual ArrayList in Java. I am testing this for mistakes, but I am learning Java and my tests maybe are not comprehensive. So I decided to ...
2
votes
1answer
29 views

Implement numbering scheme like A,B,C… AA,AB,… AAA…, similar to converting a number to radix26

I want to implement numbering scheme like Microsoft Word uses for numbering. first one gets = A,next is B, next is C, .... then AA, then AB,....and so on. as shown below A B C . . AA ...
0
votes
1answer
50 views

Am I doing this right? Merging 2 ordered source arrays into one destination array

My instructions were: Add a merge() method to the OrdArray class in the orderedArray.java program (Listing 2.4) so that you can merge two ordered source arrays into an ordered destination ...
3
votes
1answer
55 views

C# Array Mutator Methods to mimic JavaScript Array Mutator Methods

Between .NET's built-in collection libraries and LINQ extension methods, I never have to use arrays. An unfortunate consequence of this is that I am probably less competent in working with this very ...
3
votes
1answer
70 views

Better way of handling data returned from fetch_assoc() (mysqli)

So I connected to the db, pull the data using fetch_assoc() (fetch_all(NUMB) is not available on the machine we are working with else this would be less of an issue). So I get the returned data and ...
2
votes
3answers
110 views

How to improve my stack implementation (uses array)?

Below is an implementation of a stack data structure using arrays. Please comment on the same. How can it be improved? Specific improvements I am looking for: Memory leaks C++ style Making code run ...
2
votes
2answers
98 views

Is this a good way to calculate the mode of a set of ints?

Today was my first day of Data Structures and Algorithms in C++. We used C# last semester and C++ for the intro class so to get us used to C++ again we had a simple assignment to write a program to ...
4
votes
2answers
117 views

Reading a line from a text file and splitting its contents

I have this kind of file structure MALE:FooBar:32 FEMALE:BarFoo:23 Where I would want to identify the gender and age of person, <Gender>:<Name>:<age> try{ BufferedReader in = ...
4
votes
2answers
122 views

Devise an algorithm of complexity O(N) finding No of 1's from a 2 dimensional matrix[N][N] containing 1's and 0's

Assume a 2d [n][n] Matrix of 1's and 0's/ All the 1's in any row should come before 0's/The number of 1's in any row i should be atleast the no of 1's row (i+1). find a method and write a c program to ...

1 2 3 4 5 6
15 30 50 per page