Posts

सुट्टा ब्रेक

  नोट : लेख में कई जगह पर “इन लोगो” का इस्तेमाल हमारे समाज के उन हीरोज़ के लिए किया गया है जो हमारी रोज़-मर्रा की ज़िन्दगी को आसान बना देते है। ये लोग जैसे इलेक्ट्रीशियन, प्लम्बर, कारपेंटर, तकनीशियन, मजदूर आदि है। हम भारतीय लोग बॉलीवुड से भड़े ही इन्फ्लुएंस है। इसी बात पर एक फिल्म का डायलॉग मुझे याद आ गया “ इंसान की सोच ब्रांडेड होनी चाहिए कपड़े नहीं “। डायलॉग तो बड़ी गहरी बात कहता है लेकिन हम अमल कितना करते है। ज़रा एक पल ठहरीये और सोचिये आपके घर पर आने वाले इलेक्ट्रीशियन, प्लम्बर, कारपेंटर, तकनीशियन आदि लोगो को क्या हम उस मान सम्मान के साथ देखते है जिस तरह एक डॉक्टर, मल्टी -नेशनल कंपनी के एक इंजीनियर को देखा जाता है ? कई लोगो के मन ही मन में एक प्रशन की लहर उठ रही होगी की ऐसा क्यों ? यह हिन भावना कहाँ से आई ? इस का उत्तर है हमारे माता-पिता क्यों की मुझे लगता है की हम हमारा व्यवाहरिक ज्ञान हमारे घर से ही सीखते है। हां ये बात और है की उम्र दराज़ उस ज्ञान में मामूली सा ही फरक होता है लेकिन फाउंडेशन तो घर के लोगो के बीच ही बनती है। मुझे इस बात का बड़ा मग़रूर है की ये ज्ञान बड़े ...

Variable Length arguments ... Just because you don't see something doesn't mean it isn't there

Image
I use to program in C and C++. Before this incident I was fully convinced with the fact that functions receive fixed number of arguments. I never OBSERVED the behavior of functions like printf ( ), sum ( ), min ( ), etc. we taught in our courses that these functions are differ than user defined functions because they are built-in functions. Yes, It's true but few things are still need to be discovered until I came across this ... I was reading JAVA docs and I came across this ...    I think does C or C++ have also have this feature? After doing couple of clicking on Internet ... I came across this     I dig dive into it... and play it with more   Such type of functions are called "Variadic functions" which take a  variable number of argument. * To declare a variadic function, an ellipsis appears after the list of parameters. * E.g. int printf ( const char * format... ) ; , which may be preceded by an optional comma.         |_ i...

MARBLES codechef explaination...

Image
  In our problem we are having N marbles we have to pick K colors. And it is necessary that at least one marble of each color.  So now we left with N-K marbles which can be of K colors. Now this problem turns into a problem of counting in how many  ways we can distribute N-K marbles into K distinguishable colors, with no constraints. This is a problem of "combinations with repetitions" , also known as the "stars and bars problem" .  Lets journalize this whole situation for a while … We can also have an r- combination of n items with repetition. And these two conditions must be fulfilled:- order doesn't matter. we can select the same thing multiple times i.e; repetition is allowed. For example: We can choose 6 marbles where only 3 colors are available. Colors are Blue(B), Red(R) , Yellow(Y).                How many different selections can we make? Since order doesn’t matter we ‘ll list all of our selection...

Mystery of Plain, Signed and Unsigned

Image
  T here are two big players to whom this discussion begins with INT and CHAR.  Now, firstly specification about the compiler I am using from which all the following results are produced:     g++ (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 8.1.0 Let's get started, First we will demystify integers. Integer is an integral type that can represent positive and negative   whole numbers including 0  such as -1, -2, -3 … 0 … 10, 4996, 97634 etc. Since we are having infinite   negative and positive numbers in mathematics but we are having finite amounts of memory in our  computer systems. So we have to adopt some method to store different sizes of integers in our program. For example, in few use cases we might require small sets of integers numbers or in    another we might require large integer values.  C++ has created 4 different fundamental integer types available for use are as follows:- short  int l...