Latex: Change the numbering style for algorithms [closed] - algorithm

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
My problem is that I do not know how to change the numbering style for algorithms. I have created an algoritm and its number is "Algorithm 1", but I want to have "Algorithm N.1", where N is the number of current chapter.
Let assume I have something like below
\begin{algorithm}
\begin{algorithmic}
\FOR{$i = 1$ till end}
\STATE do something
\ENDFOR
\end{algorithmic}
\label{aForLoop}
\caption{some caption}
\end{algorithm}
Any help will appreciated.

As in the documentation:
The numbering of algorithms can be influenced by providing the name of the document component within which numbering should be recommenced. The legal values for this option are: part, chapter, section, subsection, subsubsection or nothing. The default value is nothing which causes algorithms to be numbered sequentially throughout the document.
So, I think it will be enough determining the section value, like that:
\begin{algorithm}[section]
...
Didn't test, but should work.

This question is already 8 years old and the link in the accepted answer doesn't work anymore, so I'll post an answer here for future reference. Also, it belongs on tex.stackexchange.com.
Just add the [chapter] (or [section]) to the package declaration
\usepackage[chapter]{algorithm}
and make sure to have a caption and a label in the algorithm, in that order:
\caption{The Foo Algorithm}
\label{algorithm:foo}

This page explains it quite well: https://web.archive.org/web/20100901100351/https://www.iam.ubc.ca/old_pages/newbury/tex/numbering.html
I assume this would work for algorithms as well by redefining the \thealgorithm command, in fact I read on a German forum that a user managed to disable numbering for algorithms by redefining this, so it should work.

Related

In AND gate how two bits turns into 1 bit? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
In Book, "But how do it know" I am trying to understand how CPU actually works. I got the concept of bit. But I am not getting this line: "The computer part has a device that does something with bits. If you have 2 bits and you connect those two bits to input, the device looks at those bits and "Decides" Whether to turn one output bit on or off"
Author explains a little later, " when both inputs are off, the output is on, so.... how do you get electricity at the output if both inputs are off?. Well, that is an excellent question, and the excellent answer is that every one of these devices is also connected to power."
HOW?
Sounds like what you are talking about is an XNOR gate. These gates are similar to AND gates but also activate when both inputs are 0.
Logic gates use power similar to how many other electrical devices do. For example, a light switch only turns on the lightbulb when you apply the correct input (closing the switch). The gates simply have a more complicated switch that activates when the correct inputs "close the switch" and allow current to flow from the power source to the output of the gate.
The internals of logic gates can get fairly complicated which is why we simplify the logic to easily identifiable boolean logic gate symbols and their corresponding truth tables. You'll notice that these symbols often don't include any power inputs as they are assumed and omitted from the boolean logic diagrams.
https://www.electronics-tutorial.net/digital-logic-gates/xnor-gate/

Description of the Kameda-Weiner algorithm? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I'm looking for an explanation of the Kameda-Weiner algorithm.
I found the paper "On the State Minimization of Nondeterministic Finite Automata" which, I assume, contains this, though it's unfortunately behind a paywall, and I'm just a hobbyist.
Can someone explain the algorithm, or point me to another source?
Although I have absolutely no idea what you are talking about, I think these two pdf files contain some sort of explanation.
Link1
Link2
I just tried to answer it, because I know how frustrating it can be, when you something you really want is behind a paywall! Hope it helps.
Cheers!
It's implemented here: https://github.com/coder0xff/parlex_legacy/blob/132e4a23a599140d22b18ead832626f0c607340f/Automata/NFA.cs#L641
(updated to fix dead link)

Algorithm vs Code [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I came across the declaration in a software best practices guide that algorithm and code shouldn't get mixed up. I'm not sure what is meant by this? As far as I understand, code is the implementation of the algorithm, isn't is? So, what exactly is meant by this statement? and why it is considered as a good practice?
Thank You!
The context in which the author mentioned would be clearer if you had pasted the surrounding lines.
Though what it would mean to me is, an algorithm is just a clear step-by-step logic that you would use to implement. You would leave out the finer implementation details like selection of the right data structure and other implementation details while you write/design the algorithm.
A good explanation can be found here
An algorithm is a series of steps for solving a problem, completing a task or performing a calculation. Algorithms are usually executed by computer programs but the term can also apply to steps in domains such as mathematics for human problem solving.
Code is a series of steps that machines can execute. In many cases, code is composed in a high level language that is then automatically translated into instructions that machines understand.

Generating first names based on race/ethnicity [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I want to generate some fake people for a piece of software I'm writing. These people also have ethnicities, and I'd prefer not to have names that don't look totally out of place when compared to those ethnicities.
My first idea was to base it on data. There is a table of first and last names from the 1990 US census with attached frequencies, but that says nothing about ethnicity. There is also a table of last names from the 2000 US census which is broken down by ethnicity, but it says nothing about first names.
So I need some way of generating first names based on ethnicity. Any ideas?
Use behindthename.com. They have very extensive lists of names by usage, including lists of popular names.
The site http://www.babynamefacts.com/ contains lists of most popular baby names per country. This may be a good starting point. For example, this page shows the most popular baby names for Serbia in 2009: http://www.babynamefacts.com/popularnames/countries.php?country=SRB .

Where does "Your Kitten of Death awaits" come from? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 12 years ago.
Improve this question
If you run SBCL (at least on Windows, I use CLISP at home), you get the message, "Your Kitten of Death awaits." I suspect that this has something to do with some form of inside joke (like Super Cow Powers). I've tried Googling and I have found nothing particularly useful (I suppose that it is mentioned elsewhere on the 'net is of some, if not much, use).
If this seems more of a SuperUser or ServerFault question, please let me know and I will ask on their forums instead.
UPDATE:
It seems that the origin of this quote is from a commit by Christopher Rhodes to version 1.54 of the original source (thanks to Daniel A. White for finding the fild name). I'm not sure if that will prove useful, but it is an additional avenue to approach this query.
Here is an interesting discussion on this very topic:
http://www.bitchx.com/log/lisp-f/lisp-f-02-Feb-2010/lisp-f-02-Feb-2010-00.php
They seem to suggest it comes from one of the following:
The nursing home cat that could detect when someone was going to die (Recent book written about the "Grim Reapurr")
The long comic series by Sluggy Freelance about satanic kittens (starts here, ends here)
Or is inspired by Death's kitten(s) in the Discworld series by Terry Pratchett (Image here)
Here is a diff that has it, but its been removed in this patch.
http://www.peerweb.nl/sbcl/sbcl-1.0.14.10-windows.patch

Resources