data-structures

SQL UPDATETEXT losing data

I have a procedure that concatenates TEXT fields inside another text field. Table A.TextField is composed of the concatenation of Table B.TextField1 + VARCHAR(8000) + B.TextField2 data. I get the TEXTPTR for the TextField1 and TextField2 and what I do is just to UPDATETEXT 3 times the A.TextField. At the end of the operation, I´m losin...

What is the correct generic name for the data structure in a calculator app that holds the numeric display

It would hold a string and have characters (numeric, or decimal point) added and removed from the right end. Ignore the case of negative numbers for simplicity. Does this kind of data structure have an agreed-upon name? Register? Buffer? Display? Something else? UPDATE: This is an internal representation and may not be the final form o...

How to allow your data structure to take in objects of any class - C++

How do I do that? Like you know in Java, you can use an ArrayList and it will take any object as long as you cast it down to whatever it is when you're retrieving the object. Even better, you can specify what class of objects that ArrayList would store by doing... new ArrayList()< whateverObject > I've implemented a linked list da...

What's this data format? It looks like some kind of reduced pseudo-XML to me...

Sorry, this might be a dumb question but I have no idea how to google this... I've got output from a CLI tool and I was wondering, what the format is called. I wouldn't want to write a parser myself if it's a common format, and I'm sure it is. It looks like this; statusList { status { int time="1260878400" value { char...

Most code-efficient way to handle data stamped as "final" vs. data that may incur changes.

Hi there, I have several models whose records AND associations can have two states that must be persisted. Final, and Draft. Here's a little more detail: If the model is "application form" and the user submits a final application form, then I need to store and be able to retrieve that final application form. If, at a later date, the u...

FIFO list (moving elements) [C++]

Good evening, people! I'm trying to solve a rather simple problem, but.. well, it seems that I can't. :) The idea is that I have a FIFO list (FIFO queue) with n elements and it's given a value, k (k < n). My little program has to move the elements to the left with k elements. (e.g. for n=4, k=3, a[]=(1, 2, 3, 4), the result is 4 1 2 3)...

Relational database data explorer / visualization?

Is there a tool that can let one browse relational data as a graph of connected nodes? For example, i'm faced with trying to cleanse some anomolous data. i can start with two offending rows. In this particular example, the TransactionID should, by business rules, be unique to the table, but i find a transaction that violates that rule: ...

Complexity running times LAB and fibonacci numbers (java)

Hi, have been looking the page and lots of great people helping outhere so i have a Lab Assignment and i know i have to do a method concerning the fibonacci numbers to caclulate the number in the position n, but im not quite sure what do put inside the method i know is what i have to think about hope you can give and idea. Having trouble...

Selection of an inefficient data structure, what problems it can create for us???

Suppose i have a software program which uses an inefficient data structure. Now how can i make it efficient. it seems that we should simply change the data structure but its not the case in reality. according to my point of view the whole software needs to be changed. what is your point of view? ...

CMS - Save pictures in database, What is the proper structure?

I currently build a CMS system that need to save a lot of pictures per article. I have a lot of questions :-) I need to show the pictures in a few sizes, with or without watermark. In addition I need to have the original picture too, for archive and admin purpose. What that I think to do right now is to save the pictures in the database...

How do I store XML data into a mysql database? I don't want foreign keys like crazy.

If my XML data is very complex, is there a way I can store this in DB? ...

Array, Dictionary or List in a session?

Hey, What would be the most efficient way of storing a set of values in a session? I'm guessing it's either a List/Array or Dictionary. Basically, when a user selects an item from a DropDownList, a value (between 1 and N where N <= 20) is sent back to the server. I'd then like this value to be used as an index (if using arrays) or key ...

Algorithm for finding intervals inside an array

Hello, I have a list which contains n intervals [0,1] each interval looks like [a(i),b(i)] 0<=a(i)<b(i)<=1 , i = 1...n I need to find an efficient algo determining for each of the n intervals if it's contained inside other intervals. I tried many option but i can only find one in O(n^2) Any suggestions ? ...

What is the definition for the height of a tree?

I can't seem to find a definitive answer for this, I'm trying to do some elementary proofs on heaps but here's what's throwing me off a little bit: Is an empty tree valid? If so, what is its height? I would think this would be 0. What is the height of a tree with a single node? I would think this would be 1 but I have seen definitions...

two links attached end to end

I read a sentence saying two links attached end-to-end. What does it look like? Suppose we have L1->A->B->C->D and L2->a->b->c->d should it be 1) L1->A->B->C->D->L2->a->b->c->d or 2) L1->A->B->C->D-> d<-c<-b<-a<-L2 ...

Two Keys Are Better Than One

I have a widget class: public class Widget { ... public string UniqueID = "856D9PWW"; public int Price = 325; public byte[] Data; ... } I would like a data structure to store my widgets in. Here's the catch - sometimes I need to find a group of widgets based in their price, and sometimes I need to find a specific ...

Finding an appropriate data structure

Hello, I have N keys. I need to find a data structure which i can do with the following operations : building it in O(N) finding min in O(1) deleting the median in O(logn) finding the n/2+7-th biggest number I thought about using a minimum heap (building is O(n),minimum is O(1) - root). however, I'm having hard time finding a way...

Data Structure for Storing Ranges...

I am wondering if anyone knows of a data structure which would efficiently handle the following situation: The data structure should store several, possibly overlapping, variable length ranges on some continuous timescale. For example, you might add the ranges a:[0,3], b:[4,7], c:[0,9]. Insertion time does not need to be particularly ...

Data structure enabling "Search by order"

I would like to know what data structure / storage strategy I should use for this problem. Each data entry in the database consists of a list of multiple ordered items, such as A-B-C-D, where A, B, C, D are different items. Suppose I have 3 entries in a database, A-B-C-D E-F-G G-H-B-A When the user entered some unordered items, I h...

what type of data structure would be efficient for searching a process table

i have to search a process table which is populated by the names of processes running on a given set of ip adresses. currently i am using multimaps in C++ with process name as key and ip address as the value. is there any other efficient data structure which can do the same task. also can i gain any sort of parallelism by using pthreads ...