Questions tagged [notation]

Notation refers to a specific way of writing various concepts, functions, etc. Usually it is introduced to abbreviate complicated expressions and make common idioms more readable.

633 questions
5
votes
1 answer

Rationale behind the C syntax for blocks

I was recently trying to find the reasons that led to the use of curly braces for blocks (compound-statements) in the C language and other languages of the same family. Thinks like square brackets for arrays or parentheses to change operator…
evuez
  • 3,257
  • 4
  • 29
  • 44
5
votes
1 answer

O(n) runtime algorithm

The algorithm below has runtime O(n) according to our professor, however I am confused as to why it is not O(n log(n)), because the outer loop can run up to log(n) times and the inner loop can run up to n times. Algoritme Loop5(n) i = 1 while i ≤…
Thomas B
  • 61
  • 3
5
votes
1 answer

Design C++ DSL for notating and transferring trees

In short I am trying to design a nicer C++ interface for a C library that sends tree-like expressions through a communication channel (à la iostreams vs stdio). I am not sure if it is possible at all to design a DSL within C++ for notating these…
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
5
votes
2 answers

How to use the music font Bravura Text?

I am trying to use an Open Type music font called Bravura Text. I want to use that font in an application that I am currently developing. I did a little research on the features of Bravura Text and the documentation of the font points out, that it…
UNIQUEorn
  • 420
  • 6
  • 17
5
votes
2 answers

What is the name of such notation?

JSON web site uses very clear notation to describe JSON's syntax: (source: json.org) What is the name of such notation? Is this is just a graphical presentation of BNF or it has it's own name?
abatishchev
  • 98,240
  • 88
  • 296
  • 433
5
votes
1 answer

Scala syntax - pass string to object

While playing around with regexps in Scala I wrote something like this: scala> val y = "Foo" y: java.lang.String = Foo scala> y "Bar" scala> As you can see, the second statement is just silently accepted. Is this legal a legal statement, and if…
Lars Westergren
  • 2,119
  • 15
  • 25
5
votes
2 answers

Space complexity O(1) storing string

I am a bit confused on space complexity. Is this O(1) space complexity or O(N) complexity? Since I am creating a string of size n, my guess is the space complexity is O(N) is that correct? ## this function takes in a string and returns the…
user2962698
  • 115
  • 2
  • 9
5
votes
8 answers

Representing code algebraically

I have a number of small algorithms that I would like to write up in a paper. They are relatively short, and concise. However, instead of writing them in pseudo-code (à la Cormen or even Knuth), I would like to write an algebraic representation of…
Dervin Thunk
  • 19,515
  • 28
  • 127
  • 217
5
votes
5 answers

Fibonacci Sequence - Find the number of digits - JavaScript

So, I have successfully written the Fibonacci sequence to create an array with the sequence of numbers, but I need to know the length (how many digits) the 500th number has. I've tried the below code, but its finding the length of the scientific…
Nicholas Hazel
  • 3,758
  • 1
  • 22
  • 34
5
votes
3 answers

Binary notation for writing bits - C#

There are some notations to write numbers in C# that tell if what you wrote is float, double, integer and so on. So I would like to write a binary number, how do I do that? Say I have a byte: byte Number = 10011000 //(8 bits) How should I write it…
Daniel Möller
  • 84,878
  • 18
  • 192
  • 214
5
votes
3 answers

Prefixing variables names to indicate their respective scope or origin?

In the companies I've been working, I've seen a lot the use of prefixes to indicate the scope or the origin of variables, for example m for classes members, i for methods intern variables and a (or p) for methods parameters: public class User { …
sp00m
  • 47,968
  • 31
  • 142
  • 252
5
votes
3 answers

Defining floating point values by base and exponent explicitly

I stumbled upon http://sourceware.org/ml/glibc-cvs/2013-q1/msg00115.html, which includes the line #define TWO5 0x1.0p5 /* 2^5 */ Apparently, TWO5 is defined as a double with the explicit value 1<<5. However, this is the first time I…
mafu
  • 31,798
  • 42
  • 154
  • 247
5
votes
2 answers

Plain English explanation of Theta notation?

What is a plain English explanation of Theta notation? With as little formal definition as possible and simple mathematics. How theta notation is different from the Big O notation ? Could anyone explain in plain English? In algorithm analysis how…
kTiwari
  • 1,488
  • 1
  • 14
  • 21
5
votes
6 answers

Why can't I write @F[1..-1] to get elements 1..last?

In Perl, the array index -1 means the last element: @F=(1,2,3); print $F[-1]; # result: 3 You can also use the $# notation instead, here $#F: @F=(1,2,3); print $F[$#F]; # result: 3 So why don't -1 and $#F give the same result when I want to…
Frank
  • 64,140
  • 93
  • 237
  • 324
5
votes
1 answer

Git: how to specify file names containing octal notation on the command line

For non-ASCII characters in file names, Git will output them in octal notation. For example: > git ls-files "\337.txt" If such a byte sequence does not represent a legal encoding (for the command line's current encoding), I'm not able to enter the…
mstrap
  • 16,808
  • 10
  • 56
  • 86