I want to learn Algorithms and become fluent in them. My goal is to land a job as a Software Development Engineer at either Google or Microsoft. I've been recommended to use the book "Introduction to Algorithms" by Cormen.
But I feel like the book is not for beginners.
Can anyone recommend a book on Algoritms that I can find easier ? o...
Hello, I need to store a graph for the map of a game inside a game server written in C.
The graph has ~200 nodes and 3 kinds of edges that can connect two nodes (these three kind can also overlap: a node can be connected by 2 edges of two different types for example). The maximum degree of a node is something like 5-6 nodes.
What I wou...
Hello, StackOverflow crowd. I have a very open-ended software design question.
I've been looking for an elagant solution to this for a while and I was wondering if anyone here had some brilliant insight into the problem. Consider this to be like a data structures puzzle.
What I am trying to do is to create a unit converter that is cap...
I do this quite a bit in my code:
self.sliderOne.frame = CGRectMake(newX, 0, self.sliderOne.frame.size.width, self.sliderOne.frame.size.height);
Is there any way to avoid this tedious code? I have tried this type of thing:
self.sliderOne.frame.origin.x = newX;
but I get a Lvalue required as left operand of assignment er...
Is speaking of a linear linked linked in contrast to a circular linked list a valid / common term? For some examples I'm posting to my students I need to distinguish between both and don't want to use terms which don't actually exist!
...
I have to do some record sub-data size calculation so created something like
function GetSubDataSize(const Rec: TRecord): integer;
begin
Result:=integer(@Rec.Field2) - integer(@Rec.Field1);
end;
Everything is ok except for one case, if one of Field is a procedure or function pointer, so in case of
TRecord = record
Field2: proce...
I'm reading the book "Clean Code" and am struggling with a concept. When discussing Objects and Data Structures, it states the following:
Objects hide their data behind abstractions and expose functions that operate on that data.
Data Structures expose their data and have no meaningful functions.
So, what I'm getting from this is th...
Hello,
I am creating a database for an application that logs data for several different nodes. The data logged looks like this:
timestamp
several integer values
several floating point values
maybe a string or two
Each node is polled separately.
I would be creating a log entry between every 10 minutes and every 10 seconds (variable ...
Is TRIE the most recommended data structure while designing something like a dictionary for storing words? Any other alternatives that improve either the time or memory performance?
I believe a hash may be good if there's no collision but then memory requirements start getting bad for overlapping words: over, overlap, overlaps, overlap...
Correct me I'm wrong but std::map is an ordered map, thus each time I insert a value the map uses an algorithm to sort its items internally, which takes some time.
My application gets information regarding some items on a constant interval.
This app keeps a map which is defined like this:
::std::map<DWORD, myItem*>
At first all item...
Like the title says, I'm looking for some kind of data structure which will allow me to store any type of class into it that I need at the time. For example:
Foo *foo = new Foo();
Bar *bar = new Bar();
someContainer.push_back( foo );
someContainer.push_back( bar );
someContainer.access( 0 )->doFooStuff();
someContainer.access( 1 )->doBa...
I have a MySQL InnoDB database.
I have a 'phone_number' field.
My data is dirtly in the sense that sometimes my data is:
(111) 222-3333
111-222-3333
111.222.3333
(111) 222 3333
How can I strip all spaces and parenthesis from my 'phone_number' field to only store my phone_number in the following format '1112223333'?
What would the S...
Why below written code doesn't gives error even when string is a reference type.
public struct example
{
public int a;
public string name;
};
public void usestruct()
{
example objExample= new example();
MessageBox.Show(objExample.name);
}
EDIT
Modifying Jon Answer, I have few more Questions.
public struct Example ...
Was wondering what would be the most effcient in memory data strucuture would be for a Theater seating plan and rendering that in a graphical form on screen for the user.
This came up as a converstation at work as we are looking at booking systems and there is a type of booking that we need to cater for that is outside of the rest of t...
What's the best way to store the following message into a data structure for easy access?
"A=abc,B=156,F=3,G=1,H=10,G=2,H=20,G=3,H=30,X=23.50,Y=xyz"
The above consists of key/value pairs of the following:
A=abc
B=156
F=3
G=1
H=10
G=2
H=20
G=3
H=30
X=23.50
Y=xyz
The tricky part is the keys F, G and H. F indicates the number of items i...
Clojure has transient analogs for some of its persistent data structures, vectors, maps and sets. For vectors, there are pop! and conj! functions, analogous to pop and conj for persistent vectors, but no peek!.
Is there a technical reason that makes an efficient implementation of peek! impossible? Or is it just not necessary in most...
in data structures and algorithms, what is meant by "Exact Graph Algorithms" ? can you give me some examples?
...
These are functions and Struct declarations I have, and I'm not allowed to change them.
DerivedA giveDerivedA ();
DerivedB giveDerivedB ();
struct Base{
QString elementId;
QString elementType;
};
struct DerivedA : Base {
int a;
int b;
};
struct DerivedB : Base {
int c;
int d;
};
But what I need is something ...
Given a number of lists of items, find the lists with matching items.
The brute force pseudo-code for this problem looks like:
foreach list L
foreach item I in list L
foreach list L2 such that L2 != L
for each item I2 in L2
if I == I2
return new 3-tuple(L, L2, I) //not impor...
How to traverse each node of a tree efficiently without recursion in C (no C++)?
Suppose I have the following node structure of that tree:
struct Node
{
struct Node* next; /* sibling node linked list */
struct Node* parent; /* parent of current node */
struct Node* child; /* first child node */
}
It's not ho...