my code is here : #include <iostream> using namespace std; struct Mhs { int nim; char nama[10]; Mhs *next; }; void fs(Mhs *m) { m = m->next; } int main() { int i; Mhs mhs[2] = { {1, "Alice", &mhs[1]}, {2, "Bob", &mhs[0
I've got problem with this part of code. My goal is to reverse a doubly linked list. I receive garbage values when I try to print out reversed list. typedef struct node{ int val; struct node* prev; struct node* next; }Node; typedef struct list{ Node*
I need a FIFO structure that supports indexing. Each element is an array of data that is saved off a device I'm reading from. The FIFO has a constant size, and at start-up each element is zeroed out. Here's some pseudo code to help understand the iss
I have two pieces of codes as the following: nodes = randsample ( n_nodes, round(j*n_nodes) )-1; nodes_seqs = arrayfun (@transfer, nodes, 'UniformOutput', false ); nodes = num2str(nodes); nodes = cellstr(nodes); file_n = strcat('fasta','_','myfilenam
I have the following list of dictionaries which contains the country and the values for corresponding servers. [ {'country': 'KR', 'values': ['Server1']}, {'country': 'IE', 'values': ['Server1', 'Server3', 'Server2']}, {'country': 'IE', 'values': ['S
I'm jumping back into Android development and am interested if there's a shorthand way of creating data structures, like arrays, dictionaries, etc. If I remember correctly, primitives are auto boxed/unboxed in Java, but I'm not sure about more advanc
I want to store arbitrary parameter data for some robotics software. I'll give some examples to clarify what I want to do: Say, for example, I want to store variables "quadruped.gait.step_height = 0.25" and "quadruped.gait.gait_type = "
Using JSoup I am scraping some data from a website that gives me pollen data. They do not have an API access, so scraping was my last resort. Using a HashMap, I am storing the date and the pollenIndex, which is how high pollen levels are that day on
Here is an implementation of a Heap in java without using array but I have some problem in inserting data in it for example when i insert 1,3,2,5,8 it inserts 5,8 two times one as subtree of 3 and another one as subtree of 2. public class Heap { priv
I have an application with employees and their work contracts. Each work contract has a Vacation. We keep track of how many days the company owes the employee ("VacationOwe") and how many he has taken ("VacationTaken"). Should I make t
Im implementing a B+Tree for a class. The Nodes are currently implemented like this: class Node { public: E* keys[order*2]; Node *children[order*2+1]; int size; Node(){ size = 0; } bool empty() { return size == 0; } bool isLeafNode() { return false;
I came across a problem stating For each node in a binary search tree, create a new duplicate node, and insert the duplicate as the left child of the original node. The resulting tree should still be a binary search tree. http://cslibrary.stanford.ed
I read on cplusplus.com that the operation to delete an element in a std::map by passing the iterator as argument is constant time. If I am not wrong(and please correct me if I am) the iterators basically are pointers to the elements in the map with
I want to design a container C of element E. E has 2 attributes (priority, name), All elements in container have unique 'name' I want to support following operations on this container C as effeciently as possible. insert:- inserts element1(name1, pri
I'm trying to compress all the ancestors of a given node by having them point to the root of the parameter node passed to private E compressToRoot (E e) throws IllegalArgumentException; For example, in the image above, if I did compressToRoot(D) then
Most articles about Dijkstra algorithm only focus on which data structure should be used to perform the "relaxing" of nodes. I'm going to use a min-heap which runs on O(m log(n)) I believe. My real question is what data structure should I used t
First off, I didn't know what to put as title, since the question is not easy to formulate shortly. I need to convolve a matrix-valued function (k) with a vector-valued function (X), each of which is defined on R^3. I need to to this in MATLAB, so na
I am reading up on B Trees and looks like they achieve the dynamic set operations in O(lg n) time . The Red Black Tree( TreeMap in java ) also achieves the same operation in asymptotically the same time frame . So I would like to know what makes B tr
i want to detect clicks on canvas elements which are drawn using paths. so far i have think of to store elements path in javascript data structure and then check the cordinates of hits which matches the elements cordinates. i belive there is algorith
I have a structure as shown below. typedef struct { attribute_code_t field_id; uint8_t instance_num; uint8_t length; uint8_t data[32]; uint32_t crc_value; }table_entry_t; I want to populate the structure as follows. entry->field_id = 54;; entry->ins
So, I'm going through a long list with different types of things. Let's say that it has names of different kinds of foods. The list might look something like this: olive potato strawberry potato potato strawberry I want to store each object type and
I'm currently trying to brush up on ADT implementations, specifically an implementation for a Linked List (I'm using Java 5 to do this). I have two questions: (1) Is this implementation I've written for add(i, x) correct and efficient? public void ad
I have a number of SQL databases, each with plenty of tables. These predominantly have randomly generated Guids as row primary keys. I would like a way to locate the table and row data associated with a given Guid (with no type information). So I was
Is there a way of iterating over a (possibly huge) std::bitset that is linear in the number of bits that are set to true? I want to prevent having to check every single position in the bitset. The iteration should successively return the indices of e
I'm reading about fuzzy logic and I just don't see how it would possibly improve machine learning algorithms in most instances (which it seems to be applied to relatively often). Take for example, k nearest neighbors. If you have a bunch a bunch of a
I'm having trouble understanding the second half of connecting a new node into a double-linked list. I'm writing an add method that takes in the node which the new node is to be inserted after. My area of difficulty is understanding how to link to th
As an optional assignment, I'm thinking about writing my own implementation of the BigInteger class, where I will provide my own methods for addition, subtraction, multiplication, etc. This will be for arbitrarily long integer numbers, even hundreds
In a desktop application, I need to store a 'database' of patient names with simple information, which can later be searched through. I'd expect on average around 1,000 patients total. Each patient will have to be linked to test results as well, alth
I'm looking for an explanation of how a hash table works - in plain English for a simpleton like me! For example, I know it takes the key, calculates the hash (I am looking for an explanation how) and then performs some kind of modulo to work out whe
A problem I keep running into when writing code that draws images of scientific data is the following: Given some floating point data, fit those data into slots (1-dimensional case) or a grid (2-dimensional case) such that each datum is in the slot o