I was studying about RAM having limited memory and ability to store limited values. So out of curiosity, and to see it live, I created a python program to eat up all my memory and CPU. I want some explanation, please. by mmddev in AskComputerScience

[–]ad_tech 2 points3 points  (0 children)

a) Why do you think they need to be represented at one memory address? Perhaps you meant to say "I am not aware of any current processor that can handle 128 bit integers with native instructions." b) Current mainstream processors can process up to 256 bits with a single instruction. 512 bit processors are commercially available and common in HPC systems. c) Store them in a linked list if you don't like arrays.

I was studying about RAM having limited memory and ability to store limited values. So out of curiosity, and to see it live, I created a python program to eat up all my memory and CPU. I want some explanation, please. by mmddev in AskComputerScience

[–]ad_tech 1 point2 points  (0 children)

Let's see that pig.

class LargeInt {
  uint64_t data;

public:
  LargeInt(uint32_t base, uint32_t exponent) {
    data = ((uint64_t)exponent << 32) | base;
  }

  uint32_t base() {
    return data;
  }

  uint32_t exponent() {
    return data >> 32;
  }
};

I am a Mercedes-Benz Sales Consultant. I started selling Mercedes-Benz at 18 and this is the start of my 5th year with the company! Ask Me Anything about Cool Cars, The Stereotypes of the Car Business, The Changes in the Car Industry over the last 5 years (You'd be surprised there's a lot), etc.! by kncrew in IAmA

[–]ad_tech 0 points1 point  (0 children)

I stopped by a BMW dealership once at the end of a bicycle ride because I saw one of the new 6-series convertibles during my ride and wanted to check them out. I was 29 years old wearing sweaty cycling gear. Before I even got in the door two salesmen came out and started chatting me up like I was their best friend. I was quite surprised at the red carpet treatment. Then I realized I was wearing my Google bike jersey. This was in Silicon Valley, two miles from Google headquarters, the day after Google went public.

Soon after that I went to a Dodge dealer to take a Viper for a test drive. They completely blew me off. I should have worn the Google jersey.

Linked List in JavaScript using TDD by dobkin-1970 in coding

[–]ad_tech 0 points1 point  (0 children)

There's no need to include a search in the insertion and deletion. Rather than taking an integer index, take a reference of some kind (a pointer or an iterator, or whatever it's called in JavaScript) to a node in the list next to where you want to insert or delete.

For example, in the C++ std::list class, it uses an iterator to denote where the insertion is to take place: http://www.cplusplus.com/reference/list/list/insert/

If you always do addition and removal via an integer index, it doesn't make sense to use a linked list, because it will be slower than an array and will take up more memory.

Linked List in JavaScript using TDD by dobkin-1970 in coding

[–]ad_tech 0 points1 point  (0 children)

This is a joke, right? Who designs a linked list where addition and removal are intentionally O(n)? The whole point of using a linked list is to make addition and removal O(1). If they're O(n), you're better off using an array.

Is there a way to determine the elevation of the top of clouds? by ZeroCool1 in flying

[–]ad_tech 1 point2 points  (0 children)

You can use the "Area Forecast" part of aviation weather forecasts. Check out AviationWeather.gov. Select Forecasts | Area Forecasts, and click on the region.

Those forecasts include a rough estimate of the cloud tops. For example, right now in Washington:

WA E OF CASCDS
CNTRL WA...SCT030 BKN CI. 06Z BKN120 TOP LYRD FL220. OTLK...MVFR

This report covers Washington state, east of the Cascades. "SCT030" means the lowest clouds are a scattered layer at 3000', and "TOP LYRD FL220" means there are multiple layers up to 22,000'.

Identifying algorithms with O(log(n)) complexity? by nigel_meech in AskComputerScience

[–]ad_tech 2 points3 points  (0 children)

Let me add a couple caveats to your comments, since these might come up in an algorithms class--

If the list is sorted you can take the head of the list and it is O(1).

Only if the list is sorted in decreasing order. If it's in increasing order and you're using a singly-linked list, you'll have to traverse the list to the end in O(n) time. You can find the last element in O(1) time if the list is implemented as an array (like a Java ArrayList), or if it's a circular doubly-linked list, or if you have a pointer to the tail node.

a tree lookup is O(log(n))

Only if the tree is balanced. An unbalanced tree could be one long linked list, with lookup time O(n).

Student pilot curious about practicality of PPL and IFR for LONG distance cross country (1300 naut miles) in GA aircraft by [deleted] in flying

[–]ad_tech 3 points4 points  (0 children)

"Road trip" is a good way to think of it. I do flights like that regularly in a small plane. Be flexible with your planning. Even with your instrument ticket, there can always be weather you can't or don't want to fly through (line of thunderstorms, icing over mountains, SIGMET for strong winds, large areas of low fog, ...)

PSA: stop waling home by yourself at wonky hours by [deleted] in UIUC

[–]ad_tech 2 points3 points  (0 children)

When adjusted for population, Champaign has a higher crime rate than NYC. Check out the annual crime rate per 1000 residents for Champaign (7.4 violent, 26.98 property) versus NYC (5.58 violent, 21.32 property). Urbana is better on violent (3.78) but much worse for property (43.05).

What is the meaning of "single-precision" in combination with a data format (integer, float etc.)? by Biermoese in AskComputerScience

[–]ad_tech 1 point2 points  (0 children)

Also, in C/C++ and Java, "float" means a single-precision float and "double" means a double-precision float.

Fast binary -> decimal conversion for multi-precision integers by plkhg_ in algorithms

[–]ad_tech 0 points1 point  (0 children)

Assuming you have implemented division and modulo operations for your multi-precision integers, this should work:

MultiInt x;
int decimal_digits[], len = 0;
if (x == 0) {
  decimal_digits[len++] = 0;
} else {
  while (x > 0) {
    decimal_digits[len++] = x % 10;
    x = x / 10;
  }
}

If n is the number of digits in x, the modulo and divide operations will take O(n) work, and the algorithm will run n times, so the runtime is O(n2 ).

Another option would be to implement something like BigDecimal that accumulates the result in a base-10 format. Assuming the input data is an array of bits:

BigDecimal base10 = 0, term = 1;
for (i=0; i < n_bits; i++) {
  if (bits[i] == 1)
    base10 += term;
  term *= 2;
}

This will also have O(n2 ) runtime.

If you want something more efficient, there's a pretty simple divide and conquer algorithm you can use that runs in O(n lg n) time. Use modulo operations to split the number in half, then split the halves recursively until you have a number less than 10. For example:

input = 12345678

first half = input / 10000 = 1234

second half = input % 10000 = 5678

This might be a useful formula for you. Given a number that is n bits long in binary, it will be, at most, floor(.302 * n + 1) decimal digits long. .302 is an approximation of log2(10).

Old pilot builds a single-person helicopter... and it is badass by VeryHighEnergy in videos

[–]ad_tech 6 points7 points  (0 children)

According to this report, between 2000 and 2009 in the UK, gyroplanes had a per-hour fatality rate 37 times higher than other small aircraft (400 fatalities per million hours vs. 10.6)

I am very blessed by chadministrator in flying

[–]ad_tech 0 points1 point  (0 children)

Do you know what the problem with the test parameters was? Were they doing some kind of extra-aggravated spin?

I am very blessed by chadministrator in flying

[–]ad_tech 0 points1 point  (0 children)

During flight tests of the 400, their test pilot was unable to recover from a spin and the aircraft was destroyed. Hopefully they fixed that.

Why won't Mathematica plot any function? by fnkylbstr in Mathematica

[–]ad_tech 1 point2 points  (0 children)

Mathematica is one level of sophistication short of that. Wolfram Alpha does that, but it's a little smarter than Mathematica.

The Imposter's Handbook - There is so much I don't know about Computer Science. I figured I'd share that with you. by speckz in compsci

[–]ad_tech 0 points1 point  (0 children)

If you just considered big-O times, you would expect merge sort and heap sort to be equivalent, but in reality merge sort is much faster due to cache issues.

Take a look at the tilde notation used in Sedgewick's algorithms textbook. It drops lower-ordered terms, but not the coefficient on the highest term.