data structures – Time complexity of algorithms


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




data structures – Given a binary min-heap, find the $k$-th element

data structures – Given a binary min-heap, find the $k$-th element – Computer Science Stack Exchange

data structures – Reverse An Array whats wrong with this type of code?

data structures – Reverse An Array whats wrong with this type of code? – Computer Science Stack Exchange

data structures – Should Binary Expressions make use of built in functions in interpreters?

I have been developing a statically typed language with support for autocasting. The language has a lot of built in functions with good support for overloading. I’ve noticed that this built in function system could be used to evaluate binary expressions by implementing operator built in functions with different overloads e.g.

int operator+(int, int)
float operator+(float, float)  
int operator-(int, int)
float operator-(float, float)  

It feels like I’m doubling up my efforts to handle operator evaluation, when realistically they could piggyback the built in method system which has type checking and links the node (my interpreter uses the visitor pattern) to the actual function that would retrieve the parameters and do some computation with them – effectively what the old operator system already has to evaluate an expression.

Does this approach sound sensible? In theory it sounds good to me but I don’t know if I’m oversighting something. I know that all languages must have a intrinsic implementation for operators, but I don’t know how they link it to the actual AST.

Implementation

If this approach is indeed a good approach, at what level should I implement the built in function support to a binary expression? For example I could adjust the parser so that when it receives 2+2 it can generate a methodCall node with parameters (2, 2) and the name operator+, which would effectively treat all operators as calls to methods from the get go. Or I could stick with a binaryExpression node and link it to the correct function during semantic analysis.

data structures – Sort a d-sorted array

Given an array (1,…,n), The array will be called d-sorted, if every key in the array is located in a distance not greater then a constant d from his location in the sorted array A

I need to write algorithms that get a d-sorted array with the length of n and sorts the array in the runtime of:

  1. Θ(n) if d is a constant
  2. Θ(n(log(log(n)))) if d is Θ(log(n))

My Attempts:
I wrote this following pseudo-code:

Sort_d_array(A(),d)
 min-heap-size <- d
 for i <- 1 to n 
    BUILD-MIN-HEAP(min-heap,heap-size)
      if min-heap not empty
        then EXTRACT-MIN <- A(i)
          if i+d<=n
            then heap-insert-min(min-heap,A(i+d))   

But in terms of runtime, all I get is BigO(nlog(log(d)))

MY METHOD: I initialized i <- 1 and then I built a min-heap that contains all of the first d elements
as long as the heap is not empty, I used EXTRACT-MIN and put the element at i index in
the array and if i+d<=n, then A(i+d) will be an element in the
min-heap

Any help?

lo.logic – Are there structures in a finite signature that are recursively categorically axiomatizable in SOL but not finitely categorically axiomatizable?

Recall that a structure $mathcal{M} = langle M, I^sigma_M rangle$ in a signature $sigma$ is categorically axiomatized by a second-order theory $T$ when, for any $sigma$-structure $mathcal{N} = langle N, I^sigma_N rangle$, $langle N, mathcal{P}(N), I^sigma_N rangle vDash T$ just in case $mathcal{N}$ is isomorphic to $mathcal{M}$.

It is fairly easy to find a structure in a finite signature that is categorically second-order axiomatizable but not finitely categorically second-order axiomatizable. Add a single function symbol $f$ to the language of second-order arithmetic, and choose a non-second-order-definable $zeta: mathbb{N} rightarrow mathbb{N}$. Then consider the theory $T$ that adds to the axioms of second-order arithmetic ($mathsf{Z}^2$) the sentence $f(bar{n}) = overline{zeta(n)}$ for each natural number $n$, where $bar{m}$ is the canonical numeral for $m$. (I owe the idea for this example to Andrew Bacon.)

This theory $T$, however, is not recursively axiomatizable. Is there a structure in a finite signature that has a recursive categorical second-order axiomatization but no finite categorical second-order axiomatization?

I believe that it is possible to find a recursively axiomatizable second-order theory $T$ whose spectrum (i.e., the set ${kappa in mathsf{Card}: exists mathcal{M} (mathcal{M} vDash T$ and $vert mathscr{M} vert = kappa)}$) is shared by no finitely axiomatizable second-order theory, using partial truth predicates. (Consider the theory with $mathsf{Z}^2$ relativized to some predicate $N$ and ${$“The cardinality of the non-$N$s is not $Sigma^1_n$-characterizable”$: n in omega}$.) But I cannot see how to turn this into a categorical theory.

data structures – So just fresh installed windows needing help debloating


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




data structures – find the strong component containing the vertex v

data structures – find the strong component containing the vertex v – Computer Science Stack Exchange

data structures – Memory allocation of priority queues

An associative dictionary is any data structure which maps keys to values. Binary search trees, hash tables, and B-trees are all examples of associative dictionaries. It is incorrect to say that an associative dictionary must be a binary search tree.

Similarly, a priority queue is any data structure which allows insertion in any order and removal in priority order. A binary heap is an example of a priority queue, but it is incorrect to say that a priority queue must be a binary heap.

There are lots of other data structures which implement priority queues, including n-ary heaps (for n greater than 2), binomial heaps, Fibonacci heaps, Brodal queues, van Emde Boas trees, and many more besides.

And that’s leaving aside the issue that a binary heap doesn’t strictly need to be stored in contiguous memory. Any storage scheme can be used as long as it can be indexed like an array and supports $O(1)$ access time.

disk structures – SQL Server Logical Device for Directories

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123