|
raddevus wrote: it reminds me that most all these data structures are built on top of an array
Many are, until you get into linked lists. That's the main exception.
There are a lot of different trees out there. B+, AVL, Red-black etc
I provide some in C# here
Bee: A Suite of Self-Balancing Binary Tree Based Dictionaries[^]
Maybe they'd be of some interest.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
honey the codewitch wrote: Many are, until you get into linked lists.
Oh, that is a good point. LinkedList is iterable list of Node (UDT).
Yes, interesting how that is the split that makes data structures different too.
Adding item or retrieving from array is O(1).
But, LinkedList retrieving is O(N) - linear.
Here's the best line I've read in the book so far, "It's easier to code it than to explain or understand it." i'm not kidding, this is in chapter 10 Priority Queues & Heaps and it cracked me up.
I searched Google Books to see if I could find that quote and you can see it here[^].
|
|
|
|
|
honey the codewitch wrote: Many are, until you get into linked lists. That's the main exception. I beg to differ ...
I've told this story before, but it can take a retelling: In my student years, I was a TA at the introductory programming course for about 1000 students a year in all sorts of engineering disciplines. About half of the departments had switched to Pascal, but the classical disciplines clung to Fortran as the only language that engineering will ever need. The Fortran and Pascal classes were made as similar as they could be, with identical homework assignments.
Except for the last one: The Pascal classes had a problem to be solved using by linked lists. The Fortran classes had a completely different problem; I have forgotten the details.
One of the girls in a Fortran class came to me, slightly annoyed: Why is is that the Pascal student are given a different problem? Are they learning something that we are not supposed to learn?
She was so actively focused on this that I spent a few minutes explaining how Pascal had this pointer mechanism, where a value could be be treated like an array index, treating the entire memory as a huge array. If you handle these array elements 4 at a time, say, for 3 data values and the fourth as the index of the next record, then you can string together records in a list. That is what they are doing for the Pascal problem. Fortran doesn't have this pointer mechanism, therefore you cannot do it in Fortran.
I don't remember how much details she asked from me, how clearly I said that in principle you could use a plain integer similar to a pointer, as an array index. In any case, I was completely unprepared when she next week came to me with a Fortran program, solving the Pascal pointer problem using an array. Is this the way you were saying that it could be done? ... That is not what you expect from a freshman chemistry girl student
I had no critical comments to her solution. She had in a fully satisfactory way implemented a linked list solution based on an underlaying array mechanism. (I really should have taken a note of her name to see where she ended up; unfortunately I didn't. I am quite sure that she must have made it well.)
Religious freedom is the freedom to say that two plus two make five.
|
|
|
|
|
That's not particularly common though. My statement was intended as a generality, not as an exhaustive absolute.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
So let's take another example: Lots of genealogy programs store family trees in a relational database. A database relation is an array - in this case, an array of person records. A person's ancestor or descendants (or both) are stored in the person record as the primary key of the related person.
If you now argue: But that's a tree - I was talking about a linked list! Then: A linked list is a special case of a tree where each node only has a single descendant. There is nothing about this special case that indicates that it requires an implementation different from a general tree.
Religious freedom is the freedom to say that two plus two make five.
|
|
|
|
|
A database index is typically implemented using some kind of b-tree, and if it's stored in a contiguous block, it's on the disk and for performance
When you do this
typedef struct node {
int data;
node* next;
} node_t;
That is a linked list. Typically that is not contiguous. It is not array. You are giving corner cases where it is an array.
I don't care about corner cases when speaking generally.
I'm talking about how data structures are made. There is not a requirement that linked lists be contiguous in memory, or on disk and they are usually not.
I stand by what I wrote.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Well, of course! If you restrict yourself to ones specific implementation technique for the general concept of a linked list, then you get that specific implementation - with the implication that you cannot store a linked list in a database relation. I think that most programmers can do it.
And while we are at it: 'Array' and 'contiguous in memory' are not synonyms. A language may allow an array to grow and shrink. An implementation may of course choose to copy the entire array to a new location every time the array size changes, or it may allocate space for the array as set of segments, making the array as a whole non-contiguous in memory. As as programmer you wouldn't see the non-contiguousness of the array. Actually, an array may be broken up into segments in any language if it crosses a page border and your machine uses a page based virtual memory system. Then you may of course argue that there is a principal difference between a runtime system splitting the array into disjunct memory segments under the hood, in a manner invisible to you, and the operating system (with the help of some tailor made hardware) splitting the array into disjunct memory segments under the hood, in a manner invisible to you.
If you want do to any decent data modelling, you should not concern yourself with whether the data structures are physically contiguous on disk, contiguous in a linear file space, contiguous in RAM etc. You should be concerned about an array qua array, a list qua list, a queue qua que, a hash table qua hash table.
I believe that doing all design - data structure design or other design - as an integral part of the coding is not going to lead to the best structures, neither data structures nor code structures. But I admit that not starting the data design by typing 'int main(int argc, char ** argv)' is a less agile approach.
Do you consider 'char ** argv' an array?
Religious freedom is the freedom to say that two plus two make five.
|
|
|
|
|
If it's not contiguous in memory it cannot be used for the same thing, and has different performance characteristics than an actual array.
And yes, I WILL concern myself with how data structures are implemented so that I can know what big O performance metrics it has.
Any language that breaks contiguousness of an array doesn't use arrays, but rather it uses a data structure that's not an array that it calls an array.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
modified 9-Sep-24 9:04am.
|
|
|
|
|
Do you consider 'char ** argv' an array?
I consider it a pointer to the first element of an array of pointers.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
|
I've been buried in legacy maintenance of other people's 💩 for a while, to the point where I really don't want to come in to work . Among other things I do our installers, which encapsulate several third-party packages. Today, we've discovered a problem that's fixed in a new version of a package. The new package requires that the old one be uninstalled before the new one goes in. While this isn't too hard, the uninstaller isn't silent and the user has to click on a number of buttons for it to do its thing.
Here's the fun part. For a long while I've wanted to have my installer click buttons automatically so that I didn't have to rely on the user doing it. Even when I include detailed and explicit instructions in my installer, they sometimes screw it up. We use Inno Setup[^] which lets you call functions in a DLL of your own from their Pascal script. I use this feature for several things that aren't easily accessible from script.
I'm implementing an auto-click feature in the DLL that spins up a thread that watches for windows with a caption and then clicks a specified button in that window. It looks like it's going to work.
I'm happier than a pig in slop .
Software Zen: delete this;
|
|
|
|
|
But according to the docs, InnoSetup does also understand the command line Parameters /SILENT and /VERSILENT. They did not work for you?
|
|
|
|
|
This is the case where the encapsulated installers don't support silent installs or uninstalls. I even have one case where a command line installer when run with the silent option still pops up a message box when it completes .
Software Zen: delete this;
|
|
|
|
|
I used to rip apart MSI files with some MSI decompiler thing that I used to have, and then modify them to make them unattended.
I wish I could remember the tool name. Orca or something?
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
MSI is an abomination before all known deities. Before we started using Inno Setup we tried InstallShield, which generated MSI. I spent over a month trying to get our stuff installed properly. When I found out they wanted over $1K for each additional user language to support localized installs, I said screw it and went looking.
After finding Inno Setup, I replicated our product install in in a single day.
Software Zen: delete this;
|
|
|
|
|
|
It was indeed called Orca, and was part of the Platform SDK.
A few links brought me here: Windows SDK - Windows app development | Microsoft Developer
There's no direct link to it however, it looks like you have to download the entire SDK just to get that one file.
[Edit]
Oh, and here. Although this still has no direct link.
|
|
|
|
|
Yes, it's Orca. But that's like doing assembly programing. I wouldn't wish it on my favorite enemy.
Bond
Keep all things as simple as possible, but no simpler. -said someone, somewhere
|
|
|
|
|
I don't remember it being terrible for modifying MSIs as long as you knew how they worked, but I wouldn't use it to build one from scratch.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix
|
|
|
|
|
Nice! My favorite projects have always been utility apps that I use personally, especially the ones that involve automation.
"Go forth into the source" - Neal Morse
"Hope is contagious"
|
|
|
|
|
Gary Wheeler wrote: I'm implementing an auto-click feature in the DLL that spins up a thread that watches for windows with a caption
Autoit?
https://www.autoitscript.com/site/[^]
|
|
|
|
|
Unfortunately the corporate IT gestapo gives me a load of crap every time I want to use third-party software. For open source / freeware I just use it and beg forgiveness if I get caught. This is what happened when they discovered I was using Inno Setup. They wanted me to stop using it, but by that time it had been used for all of our products for years. Purchased software is a PITA because they evaluate it, don't like it, and then offer an alternative that doesn't do what I need.
For this reason, I usually roll my own for this sort of thing.
Software Zen: delete this;
|
|
|
|
|
I got into that installer crap a long while ago when MS rolled out their new approach.
I'd rather stick needles in my eyes. That said, it appears I need to make $$ again, so ....
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
I work for a small tech company. Sometimes we try to look cool. Our conference room started with a web cam and a long USB extension cord plus a long HDMI cable. This setup worked just fine and everybody understood it.
Along came the board of directors and we had to get a YeaLink system[^]. There was abrasion at first, but I've grown to enjoy it. You forward a meeting to an email address attached to its PC and then you can use a touch screen device on the table to start a meeting. No need to bring a computer with you to a meeting unless you're presenting. This has been our status quo for a few years.
Fast forward to current time and the board of directors has decided we need to be more modern. We now have the Owl Labs Meeting Owl 3. This thing is a serious mess. To use it via your phone (cause there is not touch screen), you have to be on the same wifi network and install an app to start the meeting. On a laptop, you have to install an app and physically connect to a USB-C cable. In Zoom, you have to change your mic, speakers, and video to the owl. Then you have to go through multiple steps on the monitor to connect it wireless to the laptop. Anybody that had dealt with smart TVs knows there is nothing smart about this process.
I guess I'm saying meetings are bad enough without needless tech making it harder to get started.
Hogan
|
|
|
|
|
If it ain't broke, keep 'fixing' it until it is.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|