A data structure is a way of organizing data in a fashion that allows particular properties of that data to be queried and/or updated efficiently.
2
votes
0answers
29 views
How can I improve my algorithm?
This is a problem from Interview Street in Dynamic Programming section.
https://www.interviewstreet.com/challenges/dashboard/#problem/4f2c2e3780aeb
Billboards(20 points)
ADZEN is a very ...
5
votes
2answers
42 views
In Java, how to operate the sublists efficiently?
In my Java program, I need to operate on the sublists a of ArrayList or LinkedList often, like removing a sublist, comparing two sublists.
For ArrayList or LinkedList, I didn't find any good APIs to ...
-1
votes
0answers
31 views
C++ abstract member of class [closed]
I want to have a container of objects wherein one component of such an object is an abstract object.
struct labelWorldState {
b2PolygonShape shape;
b2Transform xf;
b2AABB aabb;
};
...
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 ...
9
votes
3answers
113 views
Reversing a linked list
I implemented reversing a linked list in iterative way, just by knowing we need 3 pointers and I have never seen a code before, when I coded. I ran this code and tested it, it works fine. Even for ...
2
votes
0answers
31 views
Scala: Disjoint-Sets
I would like to get some feedback on the following implementation of disjoint sets, based on disjoint-sets forests (Cormen, et.al., Introduction to Algorithms, 2nd ed., p.505ff). It should have the ...
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 ...
3
votes
1answer
118 views
A trie implementation for left to right wild card search
I was working on a task to implement auto suggest from an array of couple of thousands of strings.
Ofcourse the first and the easiest implementable was to go through each element and do ...
3
votes
1answer
56 views
Javascript PriorityQueue based on object property
I am pretty new to javascript development and its temperaments. I wrote this class which is a priority queue based on a numeric property of any object. As far as I can tell, the following code is ...
4
votes
2answers
123 views
atomic_queue - thread-safe and lock-free implementation of the FIFO data structure pattern
please review my implementation of a FIFO data structure that guarantees thread-safe access without locking.
I removed the license header block and all Doxygen comments. The original version (along ...
3
votes
1answer
58 views
mapM for both keys and values of Data.Map
I'm writing a monadic parser instance that transforms Data.Map.Map's:
instance (Ord a, FromEDN a, FromEDN b) => FromEDN (M.Map a b) where
parseEDNv (E.Map m) = mapMmap parseEDNv parseEDN m
...
12
votes
4answers
439 views
About coding habits, a small java program as an example,
This is a piece of code to solve a simple problem:)
you can find the statements of this problem with this link
http://acm.bjtu.edu.cn/problem/detail?pid=1547
import java.util.ArrayList;
public ...
0
votes
1answer
81 views
Passing Data with Qt's QSqlQueryModel
Can someone help me figure out what I am doing wrong?
I am trying to pass QSqlQueryModel reference to my List widget so it can add list items. This code below should clear db contents of my table ...
2
votes
3answers
96 views
Can someone have a look to my Chess Project?
I am currently working on an unfinished project about Chess, it will (at some point) be able to help me to make some chess variations just by pasting the FEN position while I play online.
But before ...
0
votes
0answers
100 views
Grid walking algorithm code correction [closed]
Grid Walking (Score 50 points) You are situated in an N dimensional grid at position(x_1,x2,...,x_N). The dimensions of the grid are (D_1,D_2,...D_N). In one step, you can walk one step ahead or ...