Finding the largest and smallest numbers in an array is a common programming problem. This post describes how to write a Java program to find the largest or the smallest element in a one-dimensional array. In Java Video Lecture 16, we gave two exercise questions on one-dimensional arrays. The exercise questions are as follows. Write […]
About M. Shahriar Hossain
I am an Associate Professor in the Department of Computer Science at the University of Texas at El Paso (UTEP). My specialization is Data Science (Data Mining and Machine Learning.)
Entries by M. Shahriar Hossain
A single dimensional array or a one-dimensional array can hold more than one element. Using an array, one can avoid the use of too many variables to store the same data types. As an example, a programmer can use an array variable to refer to the GPA scores of many students. In this article, I […]
Becoming skilled at anything requires determination and perseverance. Gaining expertise in programming is no different. I teach around one hundred students every year at the University of Texas at El Paso. I generally teach Programming, Data Science/Mining, and Algorithms courses. Based on what I have seen over the past years as a faculty member and […]
Printing the pyramid pattern of stars is a common practice in learning any programming language. In this post, we will learn how to print the pyramid pattern of stars in Java. The program output for a pyramid of ten lines of stars is provided below. Video lecture explaining how to print a pyramid of stars […]
Java do-while loop is one of the three looping techniques available with the language. The other two loops are: for loop and while loop. do-while is a little bit different than for or while loops. In the “for” or “while” loop, generally, a condition is checked in the beginning to realize whether the execution should […]
Nested looping refers to a loop inside another loop. Many applications require to loop over a repeated task. Nested looping is a solution to aid such repetitive tasks. As an example, consider printing ten lines on the terminal, where each line contains twenty asterisks, as shown below.
In the previous video lecture, we learned how to repeat a segment of code using a for-loop. The segment we used for repetition was small. In the following video lecture, we incorporate an if-else structure inside the scope of a for-loop. We use a simple problem to develop this practice scenario. The Problem used in […]
Repetition of segments of codes is an essential part of programming. Repeating the execution of a code segment, a programmer can reduce the size of the code as well as solve problems that require iterations of similar computations for an arbitrary number of times. Java provides three syntaxes for repetition: for loop, while loop, and […]
In the previous video-lecture, we described how if-else if-else statements work. We provided an exercise with the video-lecture. In the video with this article, we provide a solution to the exercise. Tracing a program with if-else if-else statements In the following video, we introduce a technique called tracing that we did not cover before. Tracing […]
The article is about teaching kids math with a focus on problem-solving.