Problem Solving Strategies

General chat for high school physics. For MathJax see meta.sta...
Feb 9 06:34
@JohnRennie hi sir.. Happy Birthday !!
Sep 5, 2024 04:57
I'm also good
Sep 5, 2024 04:56
It's teachers day in India. So, Happy Teacher's day :)
Sep 5, 2024 04:56
@JohnRennie hi sir..How have you been
May 21, 2024 07:13
Two more semester are remaining though..
May 21, 2024 07:13
Semester has ended... But for me college has been not so good ..
May 21, 2024 07:11
Ohh yes ! Might be very hectic for the students
May 21, 2024 07:10
How's going on there ?
May 21, 2024 07:09
Ok sir.. Np :)
May 21, 2024 07:09
And if anything else is written in the main body that will continue to run without any blocking
May 21, 2024 07:08
Sir consider the above code... Now when I call the function foo() then the executor code of promise is run on out of the call stack.. Right ?
May 21, 2024 07:08
function foo(){
  return new Promise(function(resolve, reject){
      setTimeout(function(){
        console.log("This is main promise");
        resolve("Promise is resolved");
      }, 5000);
  });
}
foo().then(function(result){
  console.log("Data from promise is " + result);
  setTimeout(function(){
    console.log("Wait done");
  }, 6000);
}).then(function(){
  console.log("This is success");
}, function(){
  console.log("This is failure");
});
May 21, 2024 07:07
Sir can I ask something about javascript here ?
May 21, 2024 07:07
I'm good too..
May 21, 2024 07:06
@JohnRennie Hi sir... How are you ?
Feb 12, 2024 13:41
@entropy this is how I would have tried this...
Feb 12, 2024 13:40
Jan 4, 2024 09:18
Thanks a lot for your time :)
Jan 4, 2024 09:18
No problem sir...
Jan 4, 2024 09:18
I was just thinking that when people say it is having high constant factor do they really calculate that or just by looking at various examples ?
Jan 4, 2024 09:16
priority_queue is using heap and multiset is using RB tree..
Jan 4, 2024 09:12
Sir.. it is said that we should not use multiset in C++ instead should use priority_queue because of constant factor. How does one even determine this constant factor ? because I think the complexity in the simple for loop is too much..
Jan 4, 2024 09:08
Is parallelization going to affect this ? probably the timer stops when it is out of context for CPU ?
Jan 4, 2024 09:07
Yes sir.. so on average I guess everything is going to take approx 1-2 cycles
Jan 4, 2024 09:06
So it just increases the runtime to almost 1/6th of the whole time
Jan 4, 2024 09:03
Yes sir
Jan 4, 2024 09:03
Yes sir.. I'm getting this. It's comparing from the i and increasing i and a. Just simple for loop
Jan 4, 2024 09:02
ok sir
Jan 4, 2024 09:01
Yes sir
Jan 4, 2024 09:01
So are these operations need only one clock cycle of CPU or I guess many
Jan 4, 2024 09:00
Ok sir
Jan 4, 2024 08:58
So here is it directly accessing the values from the memory without the register intervention ? like 8(%esp) ?
Jan 4, 2024 08:57
Is it different from MIPS ? like there we used $ to represent a register ?
Jan 4, 2024 08:55
Yes sir
Jan 4, 2024 08:52
Yes sir
Jan 4, 2024 08:49
It might have created another file in the same folder
Jan 4, 2024 08:49
@JohnRennie on the microsecond scale there is a significant difference in the runtime
Jan 4, 2024 08:46
@JohnRennie There are many things which I'm not able to get in the assembly
Jan 4, 2024 08:38
We can run it on our laptop too...
Jan 4, 2024 08:37
Yes sir
Jan 4, 2024 08:36
@JohnRennie Running at codeforces server
Jan 4, 2024 08:36
How can I get the assembly code generated by g++ ?
Jan 4, 2024 08:35
There is no difference
Jan 4, 2024 08:34
Not twice as long because the operation of for loop like comparison and increment of i is not doubled... but significantly higher
Jan 4, 2024 08:33
Would that really affect runtime too much ?
Jan 4, 2024 08:32
But Now if I declare another operation b++ isn't it supposed to significantly higher time that the previous one ?
Jan 4, 2024 08:31
so I tried something like that
for(int i = 0;i<=1e9;i++)a++;
Where a is integer.
Jan 4, 2024 08:31
Sir on various online coding platforms it is estimated that they perform around 1e9 operations per second;
Jan 4, 2024 08:29
Can you please help me understand that...