//Personally, I think this is the most beautiful algorithm ever written
public Node search (Node root, int key) {
if (root==null root. key==key)
return root;
if (root. key < key)
return search (root. right, key);
return search (root. left, key);
}
I wrote software for many years for real-time systems. Linked lists were the main data structures used, mainly because they can be updated very quickly. On the downside, searching is relatively slow in a linked list, unless you can design and code the software to maintain the linked list to facilitate the typical search. That isn't always possible though.
What kind of data was it? I do call centers. We use lists all the time but binary search will forever blow my mind.
It was part of a message passing scheme between different processes... electric power control software
Arrays all the way.
Probably because it's the first data structure I was exposed to in both coding and spreadsheets in the 80s. As such is easier for me visualize and follow the structure in my mind as I work, specially when needing to convert mono-dimensional to multi-dimensional.
Multi-dimensional? For game engines or what?
Can be in game engines, it's particularly easy to do in Lua scripting engines, but general C coding also.
For example, a 2D/multi-dimensional array
/* 2D Array (3 'rows', 4 'columns') */
int a[3][4] = { {0, 1, 2, 3}, {4, 5, 6, 7}, {8, 9, 10, 11} };
/* later referenced */
int val = a[2][3];
would be essentially the same way it's used in a spreadsheet
https://imgur.com/a/YTNkjZr
Opinion
7Opinion
Enormous list of objects that self shuffle for 0 reason at three randomly selected points in the code.
This could actually be quite useful.
Q-Basic.
Or Commodore 64... LOAD "*", 8,1 Baby!
FILE NOT FOUND ERROR
I mean, they all have their uses but probably arrays are the most common that i use.
Man linked lists are such a pain to make from scratch.
I use array for my projects most of the time.
I used to use stacks when I did searches.
I don't know maybe queue? can't say for sure
Push-down automata
You can also add your opinion below!