 Let us go over now to discuss the session on handling multidimensional arrays. I also have a problem on handling single dimensional array, which I have tried to describe. There is another slide deck, which I will upload, but for the paucity of time, I will just describe there are a few problems that I have discussed in this slide deck, but I will emphasize one special problem, which students always find very interesting that has been our experience here and of course, mention the other interesting problems also in the context of matrices. We presume here of course, that the students have been introduced to the notion of arrays. They have handled a large number of problems on arrays already. They perhaps are familiar with finding out the largest number in an array, finding out the averages and means. They are familiar with how to sort the array. In general, they have worked with one dimensional array. When we introduce two dimensional arrays or matrices, during the preparatory phase of this workshop, you would have seen one example, which related to solution of simultaneous equations. Tomorrow in my session on introducing the computer programming, I will use that video again to bring out the possibilities, which are thrown up by the availability of technology, some of which we have already tried. Here, I just want to concentrate on handling of multidimensional arrays. So, I am saying I am discussing more applications of multidimensional arrays. You have to understand the word more from the perspective that solution of simultaneous equations has already been discussed earlier in this workshop. I will briefly show the matrix multiplication problem, discuss the magic square. But more importantly, I will spend time on processing digital images, which will cover representation of images, the notion of a histogram and how contrast enhancement in pictures is done by simple matrix operations resulting in a method called histogram equalization. This requires recalculation of pixel values. We shall actually see some illustration and we will see a program to implement histogram equalization. First, some discussion on simple problem. I will not spend any time, but I will just mention that it is useful to teach our students some simple concepts like matrix multiplication. So, you have an m by n matrix and you have an n by p matrix. The matrix product a, b will be m into p matrix and it is defined mathematically as c i j equal to summation of a i k into b k j over k equal to 0 to n minus 1, where n is the common attribute between two matrices. So, notice that the number of columns of matrix a must be same as number of rows of matrix b, otherwise matrix are not compatible for multiplication operation. Having said that, you can elaborate on how matrix multiplication is done. Please note that here the design of the program is simple. It is implementation of the mathematical formula that we just saw. I will spend a few minutes on describing magic squares, because we have found that such discussion attracts the students and also clarifies subtle points of handling indices when you are dealing with matrices. Very simply stated, magic square is an n by n square matrix, where the sum of elements of every row and every column is same and additionally, sum of all the both the main diagonals is also same. So, that means if you add up elements in a row, this row or this row or you add up elements in a column, they all add up to the same value. If you add elements on this diagonal and add elements on this diagonal, they all add up to the same value. These are known as magic squares. Many students might already have known about magic squares, because these are known historically from a very ancient time. Chinese have mentioned these several Buddhist literatures in the country. I have mentioned this all over Europe and U.S. Of course, you find a very elaborate literature describing magic square. A magic square as I said is an n by n square matrix. Now, we give a demonstration or illustration 816357492. We show that every row adds up to 15. We show that every column adds up to 15 and we show that every diagonal adds up to 15. As I mentioned, these are known as low shoe square to the Chinese. The 3 by 3 magic squares were known to Indians since Vedic times. The problem that we pose to our students is that if a matrix is given, obviously it is a square matrix, is it a normal magic square or not? How do we determine this? First, we tell our students that a n by n matrix will have n rows and n columns and it will have two diagonals. To test the given matrix for being a magic square, we need to determine whether the sum of each row, sum of each column and sum of each diagonal is same. We can also tell the students that there is an additional useful relation available that for any n by n matrix such as sum, whether the sum for any row, sum of elements or any column, sum of elements of any diagonal, they all coalesce to a single value which is n into n plus 1 by 2. This is the value of the sum. We will tell our students that we are not going to spend time on proving this. There are alternate literature available which tells us that the common sum in any magic square is like this. Given this, what we can now do is to write a program to testing whether a magic square or not, we will calculate all the row and column sums, we will calculate the sums of two diagonals. If any of these sums is not as desired as this, then the square is not a magic square. But if all of them are the same value, then it is a magic square. So very simple. The program design comprises of reading an array of size n, then checking if each of these sums that I mentioned above is equal to the required sum or not. Here is a program. I will gloss over it. You can read it more leisurely because I will be uploading it on the model. I define a name square which is a two-dimensional array of size 20 by 20. Then I define two additional arrays to store the row sums and column sums. These are all 20 element arrays because maximally there can be 20 rows and 20 columns. There are only two diagonals. I use two variables d 1 sum and d 2 sum to represent the sum of elements on diagonal. Now I read the value of n and then I read all the matrix elements. I initialize r sum and c sum to 0. Row sum and column sum will start with 0 and there will be an iteration to calculate the total value of sum of all elements in any row or any one particular column. Here is an iteration to read all elements of the array. Now I calculate the sum of this which is n into n into n plus 1 by 2. Then I find the row sums and check against the required sum. So this iteration calculates the row sum. If i th element of row sum is not equal to sum, then I just simply say it is not a magic square. I will not execute this statement if I go through this entire loop. The same thing can be learned from the column sum. So this is the iteration which will calculate the column sum by adding to each element the value of the i th comma j th element of the square. Now I calculate the sums of two diagonals. So these are two simple loops. There are n elements on each diagonal and I can just add them by adding square i comma i and square n minus j minus 1 comma j if I want to do it for j. This may take some explanation for people to do because the diagonal is in this fashion and not in the increasing fashion of rows. Now check if the diagonal sums are correct or not. So check whether the diagonal sum one is equal to sum or diagonal sum two is equal to sum. If it is not then we have a problem. There is a mistake here that is I crossed it out. It should be sum and not zero. There is an alternate program. I will not spend any time in discussing this. Suffice it to say that it attempts to calculate the same sums in a slightly tricky but elegant fashion. I would not recommend teaching students using such an alternate approach. A straightforward approach is probably the best. But you can use such alternate approach with students who want to go further and experiment with different things. There are some explanations on how such sums are calculated using the tricks that I have mentioned here. Now I come to another interesting problem. The problem itself and its algorithm for solving the problem both are defined in Wikipedia. I have chosen the Wikipedia article because Wikipedia is an open source article and therefore all the material including the algorithm that they have given here is an open source. So therefore it can be freely used in our examples and in the material that we share with our students. So first we talk about digital images. A digital image is a collection of picture element values. A pixel is a picture element and the value is generally the light, intensity of the picture at a particular point. These are arranged in a two dimensional array of certain height h and certain width w. The height of the image is h and w but the way the picture is represented digitally is by a two dimensional matrix or two dimensional array which may have h rows and w columns. So suppose I have a photograph which is an image, then this photograph contains a picture. Each point in that photograph represents the intensity of light as captured at that point by the photograph. If it is a color photograph, the intensity is represented by red, blue and green components. If it is a black and white or gray scale photograph, the value is represented as an integer value between some limits typically 0 to 255. 0 means complete white, 255 means complete black. It is useful to write it there. White is 0 and 255 is black. Any value in between represents some kind of a gray shape. Observe that if I divide this image into a number of such rows amounting to the h rows which is the height of the picture and similarly I divide this picture into number of columns. The total number of columns being equal to the width of the picture. Then I have a two dimensional matrix of values. Each value inside is called a pixel value or the value of the picture element and is nothing but the magnitude of the picture. So if I have a two dimensional array, I might have values such as 0, 56, 128, 274, 12, arbitrary value. What do these values represent? These values are nothing but the intensity of light at the corresponding picture element here. There are techniques now available almost all cameras that we use are digital cameras. When they capture an image, you might see the image printed on a photographic plate. So you have a nice image printed photograph, but internally inside the camera the values of each picture point go and sit inside a two dimensional array of the kind that I am showing here. A few more details will be very interesting to the students. As I said digital images are collection of pixel values and these are arranged into an H by W array. Now each pixel value is represented either by a one bit number which means a monochrome. It is only 0 or 1. You can notify 0 as black or 0 as white and 1 as black or 1 as white. In a gray scale you have 8 bits which amount to values 0 to 255 and in case of a color image there are 24 bits. Please note that with 24 bits you can have up to 16 million colors. Although the capacity of a human eye is limited to see a small range of colors from 200 to 2000 colors. To store information about an image in a file we need the values of height, width and the type of colors present and then the values for each pixel for every color present. Monochrome or gray scale images say fingerprint images are very small size. In fact I will show you in the end a typical fingerprint image and very interesting programming course projects can be built around the analysis of such simple images. Please note that it is useful to tell our students for large images the size will be extraordinary large and therefore some kind of compression is necessary to keep the file size within limits. So, a 12 million pixel camera can produce a 36 million byte in a single image and that is too much of a story. That is why several compressed formats have been invented. These compression can be either lossy or lossless and these are the names of various formats. Other students will incidentally already would have known about a few of these types. For example a JPEG image will be perhaps most popularly known but these are the various types of images such as a bitmap image or BMP or a TIF or a JIF image. Those of us who are interested can actually look up the names definitions and explain a bit more but it is best to let the students discover these. So, one exercise we give to the students is that go and study all these formats on internet or wiki or wherever and try to determine what is the impact of these formats on the quality of the image as well as on the size of image. Now come to program. In a computer program I can write a computer program to handle and process an image. First thing I have to read the image related data inside my program. Now these pixel values of digital images can be read in a matrix and matrix elements can be processed further. This is where our association with images will end and our rigorous examination of how to write programs to handle those images will start. So to recapitulate we have told our students that images can be digitized, digital images can be stored in files. These files data from these files can be read into the matrix that we define to hold the or to represent the image and once we get it into a matrix we can process the data in that matrix. Now what the raw data is obtained by digitization of image is the set of pixel values as I just demonstrated. But to do any processing on that image there are some very many interesting techniques that have been described and in fact it is a matter of a very strong and elaborate independent field called graphics and image processing. We are not going to those details. We want to use this opportunity to tell students only about one or two important things which are relevant for processing the images to make them better. One particular thing which is used in this example is called a histogram. Now many students will know this term histogram because it comes from statistic. It is used to denote the frequencies or count of number of times that an event or incidents occur. We can use the notion of histogram in case of an image. A histogram table indicates how many times a particular value occurs in the image. So for each possible value the number of pixels in the image having that value is the histogram value. Why is this histogram important? It is useful to tell students something about it. This is an example that I have chosen. This is by the way a blurred image. There will be some non clarity. This is a sample image of pixel of size 8 pixel by 8 pixel. So each pixel is actually a square one. This is one pixel. This is another pixel. This is another pixel and so on. Notice that some pixels appear white, some appear gray, some appear pitched dark. That is obvious that it is a gray scale image and it is showing us different shades of white and black but there is no color there. Now this is an image that has been given to us. What we look at is the picture values inside the sample image. They may be of this type. Please note it is an 8 by 8 image. So there are going to be a total 64 pixel value. This is the first pixel, second pixel, third pixel, fourth pixel and so on. Now you will notice that these pixel values determine the intensity or demonstrate the intensity of light at that particular point inside the image. Here the value of this pixel is 154. If we look at the image itself it is this pixel which is the brightest. It might appear to you as a white pixel but this is not the white color. A pure white color will have a value of 255. Now the histogram as described by that equation earlier which is the number of count a particular pixel occurs in that picture. The histogram values are shown for what we call non-zero pixel. So there is exactly one pixel with pixel value 52. There are two pixels with pixel value 73. There are five pixels with pixel value 68 and so on. We also notice that the values of all pixels are between 52 and 154. One of the reasons why the image appears slightly hazy to us is that the contrast in that image is not very good. The lowest value of pixel is 54 instead of 0. The highest value of pixel is 154. Instead of 255 if we stretch these values in some orderly fashion perhaps we will be able to see a clearer image. That is the essence of this discussion on histogram equalization. So what we wish to do is that the histogram is currently concentrated in a narrow stage and we need to calculate, we need to stretch this histogram to cover all possible values. This is called histogram equalization to get a better contrast. Now we will go over to the programming issues involved in doing this histogram equalization. There is a lot of derivation on how histogram equalization formula are calculated. We will not discuss any one of those because they are not relevant for a programming course but we should tell people that doing this histogram equalization will produce a better contrast because it will stretch an image which exists in a limited range of pixel values to the full range of pixel values. To map the existing values to new values we need to calculate a new value from the old value so we have to define a function. Given a value v what should be the new value h v. For this a cumulative distribution function is used of a histogram. These are defined in these slides you may or may not wish to spend some time. It is useful I have found to ask students to read the histogram related distribution function and cumulative distribution function ahead of time. It is adequate to explain by demonstrating that a cumulative distribution function values will look like this. So for example there is 1 pixel less than 52, 4 less than 55, 6 less than 58 etcetera. This is followed by histogram equalization formula. This formula is simply taken from Wikipedia and we should tell our students that we will not discuss this formula but we will find out how to write a program to calculate this formula. There are some example of histogram equalization here where the cumulative distributed function is given here of 78 is 46. So if there is a pixel value of 78 it will be equalized using this formula h 78 equal to rounded value of 46 minus 1 divided by 63 into 255. 46 is the cumulative distribution this is the CDF value for the pixel 78. This results in a value of 1, say 82. Observe that a pixel value of 78 is now becoming larger but not arbitrarily large as per this formula it will become 182. Each pixel in the image which has a value 78 will now have this new value and we shall we should calculate such value for every pixel. The pixel values of the histogram equalization will turn out to be like this. You can indicate this point that earlier the smallest value was different now it has become 0. Earlier the largest value was 100 and something it has become 255. All the values of pixels in the entire image have been sort of stretched they have gone from 0 to 255 but this stretching has not been arbitrary it is related to the histogram of the original image. With this background we are now able to write a program for histogram calculation but what is interesting is to show people how the enhanced image will look. So this is how the enhancement of contrast result. Here is a comparison of the original and the enhanced image. I have found that students immediately appreciate the relevance of writing the associated matrix manipulation program given the input image values how to calculate an enhanced contrast image values from that. So if you look at this this is the original image and this is the contrast enhanced image. There is one more example which I have used the corresponding images by the way are available in Wikipedia and the data can be made available by digitizing any image. This is another grayscale picture. This is a picture of a scene there are some nice hilly slopes there are some trees here but you will notice that the clarity in this picture is not very good. I have shown in the next slide the histogram and the cumulative distribution function for this picture. Notice that the histogram is limited into a very narrow area of the pixel value between something like 100 and 200 and therefore the cumulative distribution function rises sharply like this. It is useful to tell our students that if we equalize the histogram then the cumulative distribution function will look like this and the pixel values will stretch all across the spectrum from 0 to 255. This will be the resultant image which you can see is much sharper. This slide captures all the four important elements of this image process. This is the original picture using the cumulative distribution function and the histogram. This is what we shall have for this picture. We shall now write a program to contrast enhance this image by doing histogram equalization. This is how the final histogram would emerge and this is how the histogram accumulated distribution function will be and the corresponding image will be this. Many of you may wonder whether what I am discussing is related to image processing or is related to program. It is true that this example occupies a considerable amount of time to explain some basics of image processing. However, the students find it very interesting later on when you discuss the program. For example, now comes the program design part where we tell them how to calculate entries in the histogram table. Here are the pixel values in the image. There is no value at 0, 1, 2. At 52, there is one value. At 68, there are five values. Here is one, here is another, here is third, here is fourth, here is fifth. How do we find that out? The program design should tell them that we should examine these locations and find out what is the value and write an accumulator for each value and calculate the total number of occurrences. However, we can tell them that all of this can be done in a single iteration if I maintain an array of counts from 0 to 255. Whatever is the element here, say 52, 52 becomes the index and I will increment whatever is the value by plus 1. So, originally it was 0. If there is a pixel which occurs at 52, it becomes 1. If a pixel occurs at 68, it will initially become 1. Another 68 occurs somewhere, it becomes 2. Finally, when I complete examining all pixels, it would have become 5. In this manner, in a single scan of the entire image, by putting a nested iteration once, I can calculate the entire set of entries into the histogram table. This is a good programming example and therefore, it is worthwhile to spend some little time in explaining the basics of images. Quite independently, if you do not want to spend time on images, you can just tell them what a histogram is. This matrix may not represent an image. It may just represent some arbitrary data. Histogram is still relevant for calculation of some statistical values from a given set of samples and therefore, this problem can be treated merely as a histogram calculation. There is a program here for histogram equalization. I will not go through the details of this program. This will be uploaded on to the model. Those of you are interested can look at this program and can try to see how such a program can be explained to the students in a classroom. The method is very simple. You show the basic calculations of the histogram calculations first. Then you demonstrate the equations that we have. Once the histogram calculations are done, you will find the minimum value from the CDF table, that is the cumulative distribution function table and then you will calculate entries into the equalizer table. This is how you will get the modified pixel values immediately. This is arguably a more involved program and this should not be used to introduce any basic concept such as handling two-dimensional matrices, etcetera. However, it is very useful to give at least one such example towards the end of discussion on matrices or arrays so that a very relevant practical problem can be associated with the programming skills. I will halt at this juncture because there are several queries. The query is raised by Rathnavel Subramanyam college. Over to you for your query please. Sir, we want to know that what are the applications, real-time application which is common under the Hemachindra problem? Oh, application of Fibonacci number problems. Very difficult to illustrate an application of Fibonacci number as in many cases of several arithmetic series. The only usefulness is perhaps the notion of the golden ratio and in graphics, but there is no other direct application that I can name. There are several algorithms which define, for example, the growth of trees or growth of population. I would suggest that you should read material on Fibonacci numbers and find out all interesting applications there. Let us go to the next centre which is R C Patel Institute. Over to you. My question is, sir, related to Armstrong number. As you told that the Fibonacci series is used for combinations. Like that, what is the use of Armstrong number? Thank you very much for this question. Let me very briefly say that if you were to many of the chemical simulations, you will find that you will find these numbers useful. Thank you for this interesting question, but we will take this offline. Let us go to the next centre. This is Netaji Subash Engineering College. Over to you. Thank you, sir. My question is to how to read the image in the code block. Whenever we are reading an image in MATLAB or in C, we have to know the header structure of the header. For example, in BMP, we have the header of 54 bytes. In case of code block, how to read an image? Let me rewind a bit. It is a very good question. A similar question would be occurring in the minds of people in general. How to read large data into the code blocks? Let me answer another question which has not been asked, but which is important. Ordinarily, when I am executing a program, it is a command line interface. If I want to read very large values of input, I will usually prepare a file containing that input. For example, I might write a set of values as 25, 104, 76, etcetera, etcetera, etcetera. Now, if I have seen statements in code blocks, I will die typing in all these values. In general, for example, when I execute a program with a dot out, I can usually say in file dot t x t. So, I am using an input redirection and my program wherever I have used the C in statement, my C in whatever I say, C in greater, greater, whatever number, I will not be typing these values in, but all of these input values would have been collected by me in a file and it will read the file. This input redirection and also the output redirection which you are familiar with, which can produce the output in a file which I can examine later on instead of looking at the output only on the screen. One question which was not raised, but which is a relevant question is that if I have code blocks, in the code blocks, what is the mechanism of such redirection? Now, this redirection can happen when you write a program. You have to have your input file or you want to create an output file in the same director in which your program decides or you can give it a path name, but there is a program execution environment setup that is possible. What I will do is either today I will give an elaborate explanation in the Moodle or I will demonstrate it tomorrow, but there is a simple mechanism that in code blocks, whenever you write your program, but you want your input to be redirected from another file or you want your output to be redirected to a file rather than giving input from terminal and collecting output from terminal. There is a simple mechanism by which you can give exactly the same command line parameter that I have shown here. This can be typed in that environment setting. Similarly, this can be typed in that environment setting. When you do that and execute the program, the input and output will come from the designated file. So, in fact, the redirection is extremely simple to implement in code blocks. Now, that is one. Let me now revert back to the question that was asked. How do I read an image in code blocks? Let me put it this way. Code blocks is not reading your image. Your program is reading your image. The program is still a CC plus plus program. Now, what you mentioned that the image files typically even the bitmap image files have headers and so on and all these file formats are well defined. Now, just as you will read that image in a C program, you have to write that entire code inside your program and it is that program which will read that image. Code blocks is merely an environment which executes your program. It is just like Microsoft environment or Unix environment. Code blocks is another environment. It is not a utility like a MATLAB. What MATLAB has done is, for some standard images, it has pre-written programs. Mostly written in CC plus plus sometime. They are the ones which are reading the file, the image file converting it into a pixel kind of map which the MATLAB is able to show. So, I hope you have got this answer. Code blocks has nothing to do with reading images or for that matter any data. The data is read by the program that you write. If you are writing a CC plus plus program, it is important that you write the program which will read the file and simply execute it using code block. Incidentally when I will discuss the file handling mechanism, you will notice that even in code blocks, all kinds of file manipulations are possible because files are external to code block anyway. I hope this has answered your question. Let us go over to another remote center very quickly called Sao, Tushila, Dhanchen, Godavad college. Over to you. The question is about the golden ratio which you explained. If we can take up that topic for the students, how can we effectively assess the understanding of students? That is my question. It is difficult to assess the understanding of the student as far as golden ratio itself is concerned. But from a programming perspective, we can ask the student the following question. How many terms of Fibonacci series I should generate and evaluate and keep finding the ratio such that in the limit when I get the ratio, it is closest to the golden ratio. There are other additional issues that may come up which need to be briefly discussed. For example, the value of the number increases very rapidly. So, when you want to calculate the ratio, you have to deal with very large numbers and you may soon hit on the limit of the integer representation. And you can use this fact to explain to the students the notion of long end and such other huge and such other data types which will permit handling of very large values. But per se, it is very difficult to assess the understanding of golden limit by the student. But I believe that our attention should be focused on whether the student has understood the underlying programming problem or not. And one advantage of this particular Fibonacci series or Hemchanda series as we call it is that later on when we discuss recursion, you can take this example again and explain how a recursive algorithm can be written. Mefko-Schlegn-Shivakashi. Okay sir, good morning sir, I am Neetu Devan from Koshleg Engineering College. So, you talked about the code block, they are open source tool. You can implement both C as well as C++ program. Is there any specific tools available for code block or image processing application? If you take MATLAB, there are a lot of pre-different comments available for reading as well as processing as well as displaying images. Is there any specific tools available in code block to do some image processing applications? Okay. Thank you sir. Thank you very much. I think this question extends what our previous participant asked. So, I will clarify once again code block is not an application package. So, please never compare it with MATLAB or any such thing. For all practical purposes code blocks is an operating system. And we never ask whether operating system can process images or do anything. So, the question is similar to asking can Unix do image processing or can Microsoft do image processing. This question is inappropriate because these are merely operating environments. The program that you write within code blocks is what they do the processing. Now MATLAB can be executed in a Microsoft OS environment or Unix environment. Code blocks is a limited environment which is written for you to execute any CC++ program. In fact, if you see the entire code blocks environment, you can execute Java programs, you can execute Python programs. It is an environment to execute program. Now what can be done is defined by what programs you execute. So, as long as you write programs in any language which will process something it will appear as if code blocks is processing it. I will repeat once again code blocks does not solve any application or programming problem. Code blocks is merely an environment which permits you to easily execute CC++ program. I will use this opportunity to mention one more thing. The reason why I have introduced code blocks and why we use code blocks or similar environment is that in the very first year when students come they find it extremely difficult to type in command lines dot slash a dot out and such thing. And that is the reason why we want to keep the complex problems associated with the operating system away from them. I will mention one particular utility in this context. Many of you would be familiar with it. It is called the turbo environment. There is a turbo C and turbo C++. How many of you at MEP course link have come across turbo C or turbo C++? Can you raise your hands please? Yes. So, you see all of and I am sure that all our 8600 colleagues somewhere or the other would have come across the turbo environment. Now, the turbo C or turbo C++ environment is merely a tool to permit you to write and execute C programs or C++ programs. So, just as it is inappropriate to ask whether turbo C can do image processing. Similarly, it is not appropriate to ask whether code blocks can do image processing. That is the answer to your first question. The second question which you did not ask but which I said is that initially at least for the first 4 or 5 weeks we have found it extremely useful and convenient for our students to use a simple environment like code blocks. Just as you or if not you directly but your students would have found using turbo environment is the simplest environment. They do not have to worry about variety of problems of the operating system and they can run their programs, type their programs. It is a small integrated development environment which helps people to quickly debug the programs also and so on. But later on towards the end of the course it is important to familiarize our students with a rigorous command line environment where the complete facets of the programming with all controls of the parameters that are passed through command lines which are used by C C plus plus and which are internalized which are all very important when large programs are developed this should be explained later. So in conclusion I will say code blocks is useful for introducing the programming concept but later on the regular programming environment should be introduced. There is Sun Gargag Baba College of Engineering Sir my question is in the series of Hain Chandra where you are calculating H8 using short and long bits. Could we use permutations there to calculate H8? Over to you sir. There are variety of ways in which the same calculations can be done but the idea there just as in Fibonacci series which we explained is actually to illustrate a simple concept that a recurrence relation can be implemented computationally using an iteration and in order to explain that that particular approach was chosen of course the numbers can be independently computed in variety of ways but my recommendation would be that this and such examples be given to illustrate one particular notion for example here we are introducing them to the notion of a recurrence relation and we are telling them how a simple recurrence relation can be implemented using iteration. So I would suggest that at such junctures additional diversions may not be very useful from the point of view of students. The Vaishnava Institute over to you. Good afternoon sir. My question is how to formulate the recurrence relation and solve them particularly for divide and conquer problems? Divide and conquer problem you are asking a question related to algorithms as professor Ranade explained the first course in programming should not be treated as a course on algorithm design for example divide and conquer strategy if at all it is explained to the students it should be explained by taking simply whatever is the divide and conquer algorithm rather than explaining the logic behind the divide and conquer algorithm that would become an algorithm design problem whereas what we should emphasize in the first course is the programming problem I am thankful for raising this question because many of us make this mistake because see we for us programming and algorithm design both are common things because we do both but in a first year first semester programming course it is absolutely essential to concentrate our attention on clarifying simple programming concept and that is why you will notice that even in the image processing example I did not go through the image processing principle of transform analysis and any such thing we are saying that somebody in the image processing area has bugged out those algorithm this is the algorithm for finding out cumulative distribution function this is the algorithm for pixel translation we are interested in seeing how we write programs using those algorithms or those formulas so this is my suggestion we will take two more questions and then we will go over to some others this is Shivaji University Kolhapur over to you good afternoon sir so I have two questions my first question is I have not understood the significance of histogram equalizer just I will elaborate on this suppose I represent the image in the form of a matrix and compute the maximum pixel value suppose it comes to be 100 then if I add 155 to all the elements it would brighten the image then what is the significance of histogram equalizer equalization ok ok thank you very much and I think this question might be in the minds of many other people so curiously this is a question which was raised by some students in my class also and exactly the same suggestion was made that if I wanted to modify why cannot I simply add or subtract I will tell you something if I add something to it I will have to add exactly the same value to all pixels now if I want to increase the value of the largest pixel to 255 what you say add is ok but if I add the same number then the smallest number will become still larger and the contrast will not change at all the idea is to stretch these values so the smallest value must go to 0 the largest value must go to 255 in fact by histogram equalization the smallest value will always become 0 the largest value will always become 255 the question is what happens to the intermediate value and by what rule an intermediate value will acquire a new value will it increase will it decrease and by what magnitude will it increase or decrease so let me counter your question by another question to you you suggested this simple addition now you took an example of one pixel value which was let us say the largest pixel value what is your suggestion on how to handle each and every other remaining pixel value so how would you like to handle some intermediate value which is neither the smallest nor the largest what exactly would you like to add or subtract this is the question would you care to speculate as to what can be done yes madam over to you so I said the same constant value which you add to the maximum pixel can be added to other but as you said the minimum should go to 0 for that we require so it is quite clear to me now so you see we want to stretch the what we can say we want to stretch the contrast the stretch the pixel so the smallest value should become 0 largest value should become 255 but intermediate value should gravitate either towards 0 or towards 255 depending upon not only what that value is but depending upon the overall nature of the picture in fact as I told you the question that you asked is a genuine question which people raised and in my class when they raised it I asked them to do two or three different exercises so for example I asked them to find out the middle value not the smallest and the largest the middle value and I said you keep the largest value to 255 the smallest value to 0 you put the middle value as exactly half the way and you move all the remaining lower values and upper values towards the largest and the smallest value by a constant formula they did that and the resulting image is so funny that you cannot recognize what the original image was the point madam is that the histogram represents the complete characteristic of that image and the histogram equalization is actually such a beautiful technique it preserves the nature of the image intact and it merely improves the contrast now unfortunately these details are part of a different discipline called image processing and why I like your question is such questions will be raised by people so my suggestion to all our colleagues is that whenever such questions are raised do not waste the time in the classroom to answer this image but do not discourage such questions so what you should say is a good question but since it relates more to the image processing it is not worthwhile discussing in a programming course however Mr or Miss so and so plus all others who are curious to know this please meet me outside the class and now such bunch of 8 or 10 people you give them some more explanation like this ask them to do some experiments ask them to do some experiment and see for themselves what kind of images come out and what you can do is after 5 days or 7 days when such enthusiastic students have done some experiments like this take the results of the experiments and spend 5 minutes telling the entire class that look this is what the bunch of enthusiastic students need and this is what has resulted this may perhaps enthuse some others to know more about image processing but the point I am making is that we should concentrate on the programming issues related to these practical examples. Thank you so much we will take one more question this is JITM University at Hyderabad over to you. Thank you sir good afternoon sir first time for trying to IIT Bombay for organizing this such a wonderful workshop thank you very much for that and I have two questions here the first one is in our analysis the previous one converting from histogram table to CDF table the thing is how we can initialize the histogram table whether we can manually enter the values or we can retrieve from the picture if we retrieve from the picture then what is the mechanism we can teach to the students in the simplest way and what is the formula for converting histogram table to CDF table first of all if you read the program I did not discuss the program but I will put it up on the model and you can read the program there is no need to input anything other than the basic image the histogram is calculated automatically by the program that is a straight forward calculation the cumulative distribution function is also calculated automatically by the program and the transformation and the new values of the pixels is also calculated in fact the formulae which are given there are simply implemented in the computer program to do these calculations our friend next to you is raising his hand so I believe he wants to add something please go ahead sir sir my question is we have a problem where we use this problem in real life can you tell me a real life example for this I cannot think of any practical problem of towers of Hanoi except that when I was a student I found it very interesting so but I will I will learn some more in fact now that we have 8600 colleagues let me throw this challenge to all those who are listening into this conversation an interesting question is raised from Hyderabad what are the possible practical examples that we can give of towers of Hanoi problem anybody who finds this answer first will be acknowledged publicly by me on the model so I will wait for a submission or an email from any one of the colleagues I hope that partially answers your question thank you this is LDRP Gujarat there is a query from this remote center over to you sir my question is can you give the best idea about the three-dimensional or n-dimensional array when to use it, when to use it, why to use it and if real life example for such an dimension I must admit that I had never applied my mind to pick up a multi-dimensional array which has more than rows and columns because arrays and matrices are the easiest to relate to many real life problems there are indeed large number of problems particularly in calculation of statistics related to what you may call data analysis running and data analysis problems are probably a bit hard to explain to people in one particular response to a similar query I had given an example where a company has to do a analysis of the following kind they market several products now they market the product into several territories and different people purchase these products in different quantum and they have various people who have targets of selling certain things in east, west, north, south etc so now if I have information about which salesman has sold which particular product in which region and on which month of the year then I get a multi-dimensional data and analysis of multi-dimensional data is a very interesting problem in fact in our computer science courses we first teach people the basic databases and when we teach them on data mining and on roll up and olap that is when we generally give these examples but you have actually raised a very important point because in the computer programming textbooks and all I have never seen a good example of a multi-dimensional array where there are two, three, four, five dimensions with a real example I will take this as a challenge and I will try to construct an example and the associated program over the next two weeks but I would suggest that since you have raised this question you may also want to try to do something similar so I will pose this as an interesting and challenging problem and let me throw this problem open to all 8500 colleagues who are attending this workshop you remember that I had given an optional assignment in the online portion and which about 300 people have submitted and there are extremely beautiful attempts by many now 300 may not be a very large number as compared to 8500 people but in absolute numbers 300 is a very large number there are 300 enthusiastic teachers among us who want to go out of the way to do something different similarly let me take the challenge from this lady that can someone feel like constructing a good example of a multi-dimensional array with a practical utility and write a program for that so that is now your question madam has become an optional assignment to the entire workshop thank you so much.