Tag: struct

61 votes
8 answers
2.3K views
`testl` eax against eax?

I am trying to understand some assembly. The assembly as follows, I am interested in the testl line: 000319d

avatar
Winford
0 1 0 9
asked 07 September, 2021
63 votes
12 answers
3K views
What is the difference between MOV and LEA?

I would like to know what the difference between these instructions is: MOV AX, [TABLE-ADDR] and LEA AX,

avatar
Juliane
0 1 0 9
asked 07 September, 2021
63 votes
5 answers
1.7K views
Why does Java switch on contiguous ints appear to run faster with added cases?

I am working on some Java code which needs to be highly optimized as it will run in hot functions that are inv

avatar
Kristopher
0 1 0 9
asked 07 September, 2021
52 votes
4 answers
2.2K views
Iterating through struct fieldnames in MATLAB

My question is easily summarized as: "Why does the following not work?" teststruct = struct('a',3,&

avatar
Lynette
0 1 0 9
asked 07 September, 2021
60 votes
8 answers
585 views
What is the difference between using constructor vs getInitialState in React / React Native?

I've seen both used interchangeably. What are the main use cases for both? Are there advantages /

avatar
Kurtis
0 1 0 9
asked 07 September, 2021
52 votes
17 answers
3K views
Why Choose Struct Over Class?

Playing around with Swift, coming from a Java background, why would you want to choose a Struct instead of a C

avatar
Juliane
0 1 0 9
asked 07 September, 2021
57 votes
6 answers
2.3K views
How is set() implemented?

I've seen people say that set objects in python have O(1) membership-checking. How are they implemented i

avatar
Dusty
0 1 0 9
asked 07 September, 2021
55 votes
20 answers
2.9K views
How to print binary tree diagram in Java?

How can I print a binary tree in Java so that the output is like: 4 / \ 2 5 My node: public cla

avatar
Alba
0 1 0 9
asked 07 September, 2021
59 votes
3 answers
1.6K views
How does the HyperLogLog algorithm work?

I've been learning about different algorithms in my spare time recently, and one that I came across which

avatar
Serina
0 1 0 9
asked 07 September, 2021
59 votes
14 answers
2.2K views
Get keys from HashMap in Java

I have a Hashmap in Java like this: private Map<String, Integer> team1 = new HashMap<String, Integer

avatar
Daniel
0 1 0 9
asked 07 September, 2021
61 votes
6 answers
2.1K views
How are multi-dimensional arrays formatted in memory?

In C, I know I can dynamically allocate a two-dimensional array on the heap using the following code: int** s

avatar
Georgie
0 1 0 9
asked 07 September, 2021
50 votes
6 answers
3K views
Why should I use Deque over Stack?

I need a Stack data structure for my use case. I should be able to push items into the data structure and I on

avatar
Omar
0 1 0 9
asked 07 September, 2021
63 votes
4 answers
2.3K views
Why do we use arrays instead of other data structures?

As I was programming, I haven't seen an instance where an array is better for storing information than an

avatar
Roger
0 1 0 9
asked 07 September, 2021
60 votes
6 answers
2.1K views
Why is std::map implemented as a red-black tree?

Why is std::map implemented as a red-black tree? There are several balanced binary search trees (BSTs) out th

avatar
Venice
0 1 0 9
asked 07 September, 2021
50 votes
30 answers
2.9K views
Array versus linked-list

Why would someone want to use a linked-list over an array? Coding a linked-list is, no doubt, a bit more work

avatar
Chaya
0 1 0 9
asked 07 September, 2021
51 votes
21 answers
1K views
What is the best way to implement nested dictionaries?

I have a data structure which essentially amounts to a nested dictionary. Let's say it looks like this:

avatar
Boyd
0 1 0 9
asked 07 September, 2021
57 votes
10 answers
1.9K views
Python Sets vs Lists

In Python, which data structure is more efficient/speedy? Assuming that order is not important to me and I wou

avatar
Trudy
0 1 0 9
asked 07 September, 2021
61 votes
12 answers
453 views
What is the difference between a map and a dictionary?

I know a map is a data structure that maps keys to values. Isn't a dictionary the same? What is the diffe

avatar
Thurman
0 1 0 9
asked 07 September, 2021
54 votes
7 answers
1.9K views
Skip List vs. Binary Search Tree

I recently came across the data structure known as a skip list. It seems to have very similar behavior to a bi

avatar
Jeff
0 1 0 9
asked 07 September, 2021
56 votes
19 answers
1.5K views
Why doesn&apos;t java.util.Set have get(int index)?

I'm sure there's a good reason, but could someone please explain why the java.util.Set interface lac

avatar
Kisha
0 1 0 9
asked 07 September, 2021