0
votes
1answer
43 views

2D Array: Retrieve the “Left” Item

I am creating a game that contains a Board and Pieces. The Board is basically a 2D array of Pieces. [Think smaller chess board] One of the things that I want to accomplish is to be able to retrieve ...
5
votes
1answer
97 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
162 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 ...
5
votes
2answers
340 views

Find all single elements in an array

I am interested in printing all numbers that do not have a match in an array. Example: 1,3,4,5,3,4,5,5,6 result 1,5,6 Please review my solution bellow. What would be a much better way for this? Any ...
3
votes
1answer
246 views

Optimising a Data Structure

I have the following 'custom' tree data structure that evolved over a strange idea on the train to a full fledged night of beer and a keyboard. This concept was to be thought of as, if given ...